Wikia

Vim Tips Wiki

Changes: Deleting nested reply threads in emails

Edit

Back to page

(Adjust previous/next navigation)
(Remove html character entities)
 
Line 13: Line 13:
 
}}
 
}}
 
I find the following setting useful when replying to email threads that have lots of lines like the following:
 
I find the following setting useful when replying to email threads that have lots of lines like the following:
> blah
+
<pre>
&gt; &gt; blah
+
> blah
&gt; &gt; &gt; blah
+
> > blah
  +
> > > blah
  +
</pre>
   
autocmd FileType mail map &lt;F8&gt; :%g/^&gt; &gt;/d&lt;CR&gt;
+
<pre>
  +
autocmd FileType mail map <F8> :%g/^> >/d<CR>
  +
</pre>
   
 
When replying to a mail and you want to remove everything except what the person you are directly replying to wrote just press F8.
 
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
 
From the example above, you would just be left with
&gt; blah
+
<pre>
  +
> blah
  +
</pre>
   
What it does is simply match any line starting with &gt; &gt; 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.
+
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.
 
The autocmd only maps F8 when using mails, this is handy if you use F8 for other things as I do.
Line 35: Line 35:
 
==Comments==
 
==Comments==
 
Why not just put the mapping in the ftplugin/mail.vim file?
 
Why not just put the mapping in the ftplugin/mail.vim file?
map &lt;buffer&gt; &lt;f8&gt; :g/. . .
+
<pre>
  +
map <buffer> <F8> :g/...
  +
</pre>
   
 
----
 
----

Latest revision as of 05:25, September 29, 2008

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.

ReferencesEdit

CommentsEdit

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.


Around Wikia's network

Random Wiki