Vim as Thunderbird’s External Editor in Linux
Posted on In Linux, SoftwareVim is an excellent editor which I use every day. Thunderbird is a nice email application. However, Thunderbird’s integrated editor is not efficient enough to a Vim user. Why not use Vim as Thunderbird’s editor? In this tutorial, we will introduce how to integrate Vim with Thunderbird together in Linux.
Table of Contents
Install the “External Editor” Thunderbird extension
Download the “External Editor” plugin.
And install it to Thunderbird.
Configure the external editor
Option 1: use gvim
This is an easy method which use gvim.
In External Editor’s Preference, set the Text Editor to:
gvim -f
Option 2: use vim in a terminal
If you prefer to use vim in a terminal as me, you may consider this option. Setting vim in the editor will simply fail.
First, create a script “callvim”:
#!/bin/bash # we need a little trick to use vim inside gnome-terminal. # Update on Oct. 22, 2013: This trick does not work on gnome-terminal 3.8.4 # the "--disable-factory" trick does not make the terminal run in foreground. # You can use `gvim -f` or `xterm` instead. # gnome-terminal --geometry=80x40 --disable-factory -e "vim $*" # use xterm xterm -e vim $*
Save it to a directory in your $PATH, such as ~/bin/, and remember to give it executable by ‘chmod +x callvim’.
Then, set the Text Editor in External Editor’s Preference to
callvim
How to use it
When creating or editing email, invoke vim to edit it by the keyboard shortcut Ctrl+E.
Edit the email in Vim and save and exit. The email in Thunderbird’s editor is changed.
Customize Vim for editing email
We can customize Vim to be a better email editor by set email-specific configuration in ~/.vimrc. Below is my configuration in .vimrc which set the text width to 68 charactors, set automatic spell check, default file encoding to be iso8859-1 and utf-8. Abbreviation is also available, which may be frequently used in writing email.
My email configuration in ~/.vimrc
au FileType mail call FT_mail() function FT_mail() set nocindent set noautoindent set textwidth=68 " reformat for 72 char lines " normal gggqGgg " settings setlocal spell spelllang=en " setlocal fileencoding=iso8859-1,utf-8 set fileencodings=iso8859-1,utf-8 " abbreviations iabbr gd Good Day! endfunction
Update: gnome-terminal (3.8.4) in Gnome 3 does not work with the `callvim` script. Updated to use `xterm`.
Hi Zhiqiang
Thank you for posting this.
It’s rather old, but I just tried it with urxvt and it works flawlessly.
Have a good day.
cee
Hi cee,
Very glad to know it help.
BTW: first time to know urxvt.
yeah, urxvt (the rxvt family), rxvt-unicode-256color are great, unicode terminals that can even be perl scripted.
anyway, the command for urxvt is, or can be, :
urxvt -g 80×26 -title “vim icedove email” -e vim -f
Don’t append a $* or anything, and the title is optional. The title just means that your window manager can identify the window if you wish it to be positioned or in anyway managed by your ‘window’ ‘manager’.
I needed to add ‘syntax on’ to FT_mail().