Vim Tips Wiki
Tip 228 Printable Monobook Previous Next

created March 24, 2002 · complexity intermediate · author Darren Greaves · version 6.0

I find the following setting useful when replying to email threads that have lots of lines like the following:

> blah
> > blah
> > > blah
autocmd FileType mail map <F8> :%g/^> >/d<CR>

When replying to a mail and you want to remove everything except what the person you are directly replying to wrote just press F8.

From the example above, you would just be left with

> blah

What it does is simply match any line starting with > > and deletes it. It's not perfect as sigs and other debris may remain but it takes a lot of the grunt work out of replying to mails.

The autocmd only maps F8 when using mails, this is handy if you use F8 for other things as I do.



Why not just put the mapping in the ftplugin/mail.vim file?

map <buffer> <F8> :g/...

Have a look at Brian Medley's email ftplugin.