Vim Tips Wiki

Deleting nested reply threads in emails

Redirected from VimTip228

1,624pages on
this wiki
Add New Page
Talk0 Share
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.

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.