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

32832Re: map in autocmd

Expand Messages
  • Gary Johnson
    Oct 1, 2002
    • 0 Attachment
      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".

      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.

      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

      --
      Gary Johnson | Agilent Technologies
      garyjohn@... | Spokane, Washington, USA
    • Show all 6 messages in this topic