Transfer the Power of Vim Editor to Thunderbird for Composing Email

by Ramesh Natarajan on April 2, 2009

Thunderbird Email LogoThis article is written by SathiyaMoorthy.
 
This article is part of the on-going Vi / Vim Tips and Tricks Series.  In this article, let us review how to use Vim Editor for composing email in Thunderbird.
 
 
External editor Plugin does the magic of composing email in Vi/Vim editor easily, allowing us to utilize all the features of the vim editor without compromising a single thing.
 
 

3 Steps to Install and Configure Thunderbird External editor Plugin

Step 1: Download the thunderbird external editor plugin

Download the thunderbird external editor plugin from globs.org
 
Go to the globs.org download page, click on the external editor which will show the available two versions. Download the right version for you.

  • select & download the version 0.7.4 if you are using thunderbird 2.0.*
  • select & download the version 0.8.0 if you are using thunderbird 3.0.*

Step 2: Install the external editor plugin

Open the Thunderbird, Click on Tools menu, and then select the Add ons and then click the Install button. This will open the local file browser window, select the downloaded file. It will do the installation.

Step 3: Select/Enabling the external editor as VIM

Click on Tools menu, and then select Add Ons, and then select the Preferences of External editor in Add ons Extension window.
 
Enter the “xterm -e vim” in the Text editor input box.

Use the Vi/Vim editor for composing e-mail

Now you are ready to compose your email in vim editor.
 
When you are in the compose window, press CTRL + E it will open the VIM editor as shown in the figure 1. After completing the editing, if you close the editor the content will be shown in the compose window as shown in the figure 3.

Vim Compose Email - Plain Content

 

Fig 1: Press Ctrl-E to Launch Vim to compose email

Vim External Editor - Compose Email

Fig 2: Thunderbird – Composing an email in Vim Editor

 
So after completing composing the mail, save and quit it by :wq , then the edited content will be placed in the compose window as shown in this figure 3.

Vim Compose Email in Thunderbird Editor

Fig 3: Email body from Vim transferred to Thunderbird compose window automatically

 
Note: Until you close the vim editor your compose window will be disabled, and you will be able to work in VIM editor.
 
There are two alternate ways to invoke the vim editor for composing the email:

  1. Select Tools in compose window and then click on External editor which will take you to the vim compose window.
  2. Click on the VIM icon in the compose window. To make the icon available in the compose window, right click on the tool bar, and select customize. Drag and drop the external editor.

Editing the Email Headers

You can toggle between enable/disable header editing by selecting the option in the preferences
window of the external editor.

1. Disable the Header Editing.

Unmark the Edit headers check box in the preferences window.

Vim External Editor Settings Window

Fig 4: Un-check the “Edit headers” check-box to disable editing headers

 
So if you invoke the compose the window, VIM editor will be shown without the mail header as shown in the figure 5.

Vim - Compose Email without external editor

Fig 5: Use VIM editor without the email header

2. Enable the Header Editing.

Select the “Edit headers” check-box option in the Preferences window.
 
By default the header will be enabled. If you invoke the vim editor from compose window you will be able to edit header also.
 

Recommended Reading

Learning the Vi and Vim Editors, by Arnold Robbins. I’m a command-line junkie. So, naturally I’m a huge fan of Vi and Vim editors. Several years back, when I wrote lot of C code on Linux, I used to carry the Vi editor pocket reference with me all the times. Even if you’ve been using Vi and Vim Editors for several years and have not read this book, please do yourself a favor and read this book. You’ll be amazed with the capabilities of Vim editor.

 
This article is part of the ongoing Vi / Vim Tips and Tricks series. Please subscribe to TheGeekStuff and don’t miss any future Vi and Vim editor tips and tricks.
 
This article was written by SathiyaMoorthy, author of 15 Practical Linux Find Command Examples article. The Geek Stuff welcomes your tips and guest articles


Linux Sysadmin Course Linux provides several powerful administrative tools and utilities which will help you to manage your systems effectively. If you don’t know what these tools are and how to use them, you could be spending lot of time trying to perform even the basic administrative tasks. The focus of this course is to help you understand system administration tools, which will help you to become an effective Linux system administrator.
Get the Linux Sysadmin Course Now!

If you enjoyed this article, you might also like..

  1. 50 Linux Sysadmin Tutorials
  2. 50 Most Frequently Used Linux Commands (With Examples)
  3. Top 25 Best Linux Performance Monitoring and Debugging Tools
  4. Mommy, I found it! – 15 Practical Linux Find Command Examples
  5. Linux 101 Hacks 2nd Edition eBook Linux 101 Hacks Book

Bash 101 Hacks Book Sed and Awk 101 Hacks Book Nagios Core 3 Book Vim 101 Hacks Book

{ 13 comments… read them below or add one }

1 sasikala April 5, 2009 at 11:40 pm

Its very useful for vim addicts.

2 jrg May 6, 2009 at 5:03 pm

One thing I wanted to point out that I had to do to get this to work (Ubuntu 9.04, Thunderbird 2.0.0.21). The “External Editor” button must be added to the compose message frame, or nothing will happen, and the following message will be logged under Tools > Error Console :

Error: document.getElementById(“exteditor_editAsHtml”) has no properties
Source File: chrome://exteditor/content/exteditor.js
Line: 458

Hope this help someone avoid some headache.

3 Ramesh Natarajan May 8, 2009 at 5:42 pm

@Sasikala,
Thanks for your comment. Yep. This is good for those Vim addicts who also love Thunderbird.
 
@jrg,
Thanks a lot for sharing the issue that you encountered and it’s solution. I’m pretty sure your solution is going to avoid somebody’s headache.

4 Vladimir August 18, 2009 at 1:31 am

Thanks for this post. It lacked the vim editor in thunderbird

5 acevery September 27, 2009 at 7:58 pm

@jrg,
thanks for saving me from my headache :)

6 Paul Brannan December 7, 2009 at 12:25 pm

Nice howto.

It’s a shame that this technique leaves vim as a second-class citizen. Editing directly in the thunderbird window with gvim would be much cleaner.

7 Putrid Melon January 6, 2010 at 9:49 pm

@sasikala
But what if I’m not a vim addict? I mean, I use vim, but I don’t think I’m addicted. Do you think this add-on is still useful for me?

@Paul
Yeah… *sigh*… If only vim could be a first-class citizen… Being a second-class citizen is no fun. And if only we could have a “much cleaner” way of editing inside the Thunderbird window… cause as they say: cleaner is better. Thanks for your great comment.

8 SR September 12, 2010 at 3:10 pm

gvim –nofork “+set ft=mail” should be sufficient

9 elwoode December 4, 2010 at 5:30 am

Followed this exactly but it doesnt work.
Does this work for anyone else using Vim ver 7.3 ?

10 Atanu March 28, 2011 at 1:07 pm

Thanks to the author of the plugin. Great Job!

For gvim and probably other gnome desktops:

Set “Text Editor” to “gnome-terminal –disable-factory -x gvim -f -u
NONE”

Off-course you can do more gymnastics with gnome-terminal and gvim options.

@Paul and Putrid,
Rightly said. It would be great if we can replace the built-in editor with our favs. as was the case with the command line email clients. Personally I am happy with the little tid-bits – second hand or otherwise…

11 Ukr June 5, 2011 at 1:51 am

Why is this plug-in not available officially through Mozilla Thunderbird addons? It would really increase users’ trust.

12 Frank August 11, 2011 at 5:44 am

Doesn’t work for me. Tested version 0.9.0 with Icedove 3.1.11. The external editor comes up, but after saving and closing the message, the composing windows doesn’t get updated. However, the edited message file (.eml) can still be found in /tmp — world-readable! Brilliant.

13 ialexs October 25, 2012 at 1:14 am

works for me on thunderbird 16.x
external editor set as “/usr/bin/gvim –nofork”

just make sure in your ‘edit’ –> ‘account settings’ –> ‘composition & addressing’ –> uncheck the ‘compose messages in html format’

Leave a Comment

Previous post:

Next post: