Loading ...
Sorry, an error occurred while loading the content.

Re: map in autocmd

Expand Messages
  • Pascal Brugier
    ... Yes, this was the problem, thank you it works now. ... I want to say that when I began to edit the mail body with mutt the autocmd has to be executed when
    Message 1 of 6 , Oct 2, 2002
    • 0 Attachment
      On Tue, Oct 01, 2002 at 09:01:40PM -0700, Gary Johnson wrote:
      > On Tue, Oct 01, 2002 at 11:19:52PM +0200, Pascal Brugier wrote:
      > > On Tue, Oct 01, 2002 at 09:36:37AM -0700, Gary Johnson wrote:
      > > > On Tue, Oct 01, 2002 at 01:22:54PM +0200, Pascal Brugier wrote:
      > > > > Hi
      > > > >
      > > > > I made a map to remove signature in a mail forward:
      > > > >
      > > > > map! ,W /^.*> -- $<CR><Esc>ma<Esc>/^$<CR><Esc>mb<Esc>:'a,'bd<CR><Esc>
      > > > >
      > > > > And i want to use autocmd to execute this map at each time i
      > > > > forward a mail.
      > > > >
      > > > > I find the beginning:
      > > > >
      > > > > au BufRead /tmp/mutt-*
      > > > >
      > > > > but I'm unable to find the good end to this command, for doing what
      > > > > i want.
      > > >
      > > > I think this should do it:
      > > >
      > > > au BufRead /tmp/mutt-* normal ,W
      > > >
      > > > At least that worked for the simple example I tried.
      > > >
      > > > HTH,
      > > > Gary
      > >
      > > I think I've to give better request.
      > >
      > > It's a question for i can ask here or in the mutt mailing list, i
      > > begun here.
      > >
      > > As i said i made a map in my .vimrc and what i want now is to
      > > remove automatically "forwarded signature" in mail ( it works
      > > manually) when i forward mail with mutt.
      > >
      > > Perhaps the problem that "au BufRead /tmp/mutt-* normal ,W"
      > > doesn't work for me come from the use of this autocmd from mutt
      > > edition,and i don't understand why.
      >
      > I noticed something I missed before, and that is that you are using
      > "map!", which works in insert mode, rather than "map", which works in
      > normal mode. That might explain why the autocommand is not working for
      > you. See ":help map-modes".

      Yes, this was the problem, thank you it works now.

      >
      > I don't understand what you mean by using this autocmd "from mutt
      > edition". If you could explain this more fully, I might be able to
      > offer better suggestions.

      I want to say that when I began to edit the mail body with mutt
      the autocmd has to be executed when mutt starts vim (my mail
      editor in mutt) for editing the mail.

      But this problem is solved with "map", it isn't with "map!"

      Now i just have to make the map to avoid the vim error when the
      map doesn't find the search pattern.

      >
      > You might also try this, which is a more direct approach to solving your
      > original problem of deleting signatures:
      >
      > au BufRead /tmp/mutt-* silent! /^> -- $/,/^$/d
      >
      > Gary

      I'll thank you very much
      Pascal

      --
      Pascal Brugier
      ---------------------------------------------------------------
      Easter-eggs Spécialiste GNU/Linux
      44-46 rue de l'Ouest - 75014 Paris - France - Métro Gaité
      Phone: +33 (0) 1 43 35 00 37 - Fax: +33 (0) 1 43 35 00 76
      mailto:pbrugier@... - http://www.easter-eggs.com
      ---------------------------------------------------------------
      709D77A2 - ED24 4E29 E5B4 FDE7 56A4 352D F24E 7E68 709D 77A2
      _______________________________________________________________
    Your message has been successfully submitted and would be delivered to recipients shortly.