JNRowe

Text editors - vim

Some short notes on vim

vim

I'm going to start by getting vim out the way, because it is the least used by functionality. vim pretty much only gets used on this box for editing mail with mutt. vim provides some good features for editing mail, the most important being speed. Very little will match a GUI-less version in startup. And on top of that the high quality mail syntax highlighting, and plugin/command support.

When you're editing mail with vim, Hugo Haas' uri-ref plugin is likely to come in handy. It provides a simple way to manage a list of URIs in a mail. It automatically numbers references, and adds the URI to an automatically numbered list just before your signature. It saves people from the agony of having to skip over the 5000 character URIs mid-paragraph you might otherwise paste directly in to a mail.

mutt also helps a lot when you're editing mail, automatically wrapping and quoting when replying. If you don't use mutt and your MUA doesn't support this there are also a few other cool features vim provides for editing mail. For example, when editing a file that vim recognises as mail you can use <LocalLeader>q (probably \q on your system) to quote the text from the cursor to the end of the file using '> '. And you can also use the normal vim formatting commands like gq to reformat lines, paragraphs or entire files for you.

Note

If you're not all that accustomed with vim be sure to read the help information for gq to see how to affect specific lines/paragraphs/etc(:help gq) with the command.

If you are one of those twisted people, like me, who occasionally still uses mail to send mail you can also directly pipe from vim's command line. Something simple like :r!mail -s "test" someone@example.com <% will send the current file to someone@example.com with the subject "test".

Another fantastic script for editing mail with vim is tearoff.vim, available from the vim website. It provides a simple way to insert visual cut marks like --------%<--------- in text. This is in my opinion a considerably more visually appealing method of "snipping" a section of email than the usual "<snip>" people use. And of course, it allows the reader to realise that a section has been removed that the just-deleting-lines method of snipping doesn't.

Return to Top