Vim as External Editor for Thunderbird 3 under Ubuntu
Recently I upgraded to Ubuntu 10.04 Lucid Lynx which includes the newest Thunderbird 3.0 email application. This version is really nice: offers tabbed interface for reading emails (unfortunately composing a new email does not work in a tab) and a very powerful search.
But as always with the bleeding edge version, all add-ons stopped to work. Because I had to reconfigure everything anyway and find new ways for doing usual things like signatures wanted, at this occasion I decided to finally set up the vim as external editor for new messages.
There a lot of howtos out there, none of them worked for me though and it took me some time to figure out, how to get the stuff working. So here is my documentation…
- Ubuntu 10.04 Lucid Lynx
- hence Thunderbird 3.0
- and gnome-terminal as the terminal of choice
- vim 7.0, not gvim
- install the External Editor 0.8.0 Add-on from authors site
- in Thunderbird menu Tools > Add-Ons > Preferences for “External Editor” set Text Editor to
gnome-terminal --geometry=110x40 --disable-factory -x vim
- create a new message with Ctrl+N
- press Ctrl+E to edit the message in vim
:wqto save the message, then the Thunderbird GUI is automatically updated with the new content
- I use
--geometryto make the editing window a bit bigger than default
--disable-factoryensures, that the call does not return immediately but waits until you have edited and saved the message
-x vimand not
-e vimis also important because the Add-on seems to simply append the parameters to the end of the line and to get the temporary file name properly propagated to vim it is crucial that all the remaining command line is interpreted as a single shell command
Using a powerful and comfortable editor solves lot of other problems - for signatures, for example, I can now use vim abbreviations. Just put following in the .vimrc file
iab brr \<CR>Best Regards, \<CR> \<CR>Vladimir
Now I can type
brr<Enter> to get the complete signature. You can also easily create a macro which extracts the first name of the recipient and puts a greeting together.
Fix keyboard shortcuts
One of annoyances of Thunderbird 3.0 is that the keyboard shortcuts changed under linux. “J” and “K” keys were traditionally used to go to the next or previous message in the email message overview (like in vim). And now “J” means “Mark as junk and delete”!? WTF!? It took me three deleted messages till I got, what happened. You can reconfigure shortcuts with the keyconfig addon though.
Just write an email
Sometimes while in the middle of doing something I remember that I have to tell X to person Y. So just switch to the email application to write new message. Oh, there are new emails in the inbox! So just skim over the subjects! Oh, this one looks interesting/important, lets check what is inside… and the context is lost.
Better solution is to bind
thunderbird -compose to a global keyboard shortcut. This opens a window just for composing an email without the distracting main email overview window.