sponsor Vim development Vim logo Vim Book Ad

OutlookVim : Use Vim to edit the body of an email for Microsoft Outlook

 script karma  Rating 113/48, Downloaded by 7440  Comments, bugs, improvements  Vim wiki

created by
David Fishburn
script type
For Windows users, this plugin will allow you to add a button in Microsoft Outlook which will create a new buffer in Vim with the body of the current email.  The buffer can be edited in:
    1.  Any instance of a running Vim (multiple buffers).
    2.  A specific instance of Vim (if you like to group your Vim's by project).
    3.  Whether to use a new tab (for each mail).

There are many ways to customize OutlookVim so that it will fit how you use Vim.  Besides the 3 basics above, you can also control which commands Vim uses to edit the mail to complete customization.

You can also add 4 more buttons to Outlook's Inbox view, to Compose, Reply, ReplyAll or Forward any highlighted messages in the Inbox.

The filetype of the buffer is automatically set to "mail".  This allows you to use all of Vim's great plugins and editing features to alter the email and customize the buffer using Vim's standard filetype support.  When finished, simply saving the file will automatically update the body of the email in Microsoft Outlook.

You can also also edit HTML emails, though this is disabled by default.  See :h outlook.txt and look for the option g:outlook_supported_body_format.

You can send any buffer you are currently editing in Vim into a new Outlook email by running the command:

This has been tested with:
    Outlook 2003 (WinXP SP3)
    Outlook 2007 (Windows 7 64bit and 32bit)
    Outlook 2010 (Windows 7 64bit and 32bit)

There are a number of preferences you can set within the plugin to customize it for your use.  
These settings can be explored here:
    :h outlook-configuration
    :h outlook.txt

Installation instructions for Outlook can be found here:
    :h outlook-macro
    :h outlook.txt

NOTE:  All code is included in these files.  There are no executable files you need to run on your system.   For those interested, the documentation outlines how Vim and Outlook communicate with each other.

If your Vim is Unicode enabled (:set encoding? fileencodings?), you will be able to edit emails which contain Unicode characters.  
    :h outlook-Unicode

Please use the vim_use group to post comments and suggestions.

install details
Unzip outlookvim_vXXX.zip into your $VIM/vimfiles directory.  

To update the Vim Help, run:
:helptags $VIM/vimfiles/doc  (Windows)

The help contains two pieces of important information:
:h outlookvim

1.  How to install two buttons in Outlook to launch Vim
2.  How to configure your Vim plugin to your file locations and your preferences.

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
outlookvim_v14.zip 14.0 2016-02-18 7.0 David Fishburn Added Vim Licence
outlookvim_v13.zip 13.0 2013-10-24 7.0 David Fishburn Bug Fixes
- OutlookVim globally set the textwidth for Vim if g:outlook_textwidth is defined, instead of setting the textwidth for the specific email buffer opened when editing an email.  The textwidth for the buffer will only be set if g:outlook_textwidth is set and > 0 (Antonis Loumiotis).
outlookvim_v12.zip 12.0 2013-09-07 7.0 David Fishburn New Features
- Four new macros have been added for the Outlook toolbars, Compose, Reply, ReplyToAll, Forward.  Unlike the previous Edit macro these macros can be used from your Inbox view.  They can be added to the Inbox toolbar and will simply open the selected email items and automatically launch Vim.  These macros support selecting multiple items in your Inbox.  Compose obviously creates only a single email (Jörn Waterstraat).
- New option g:outlook_edit_cmd (defaults to "edit") allows you to control what command will be used to edit a new email.  For example, if you wanted a split at the bottom of Vim, you could set it to 'botright split'.
Bug Fixes
- In some cases when opening am email in Vim which was in insert mode or having unsaved text it was possible for the text to be overwritten (Gary Johnson).
outlookvim_v11.zip 11.0 2013-06-15 7.0 David Fishburn New Features
- Changed how the filetype is set for Outlook.  The g:outlook_file_type will be used for all mail.  If g:outlook_supported_body_format = 'html' and the buffer begins with the html tag the filetype will be set to 'html'.
Bug Fixes
- g:outlook_supported_body_format was not checked in the Outlook macro, a previous variable name was used (Gary Johnson).
outlookvim_v10.zip 10.0 2013-06-01 7.0 David Fishburn New Features
- Editing HTML formated Outlook emails is now supported.  A new option has been added, g:outlook_supported_body_format, can have one of two values: plain or html.

NOTE: Outlook html contains a lot of markup tags.  It can make it difficult to find the body text within all the tags.

- A new option has been added, g:outlook_file_type, which defaults to 'mail'.  When opening the buffer within Vim, this file type is set for the buffer.   You may want to change this value if you are editig HTM emails.

- A new command has been added: OutlookNewEmail.  This will take the contents of the existing buffer and create a new Outlook email.  If the filetype is 'html' and g:outlook_supported_body_format = 'html', the email body will be html rather than plain text.  The command can be run as often as necessary, a new Outlook email will be created each time.
Bug Fixes
- The additional changes to the VB code to support both 32-bit and 64-bit platforms does not work with Outlook 2007 32-bit (at least).  The new changes will work for either (Greg Dunn).
outlookvim_v9.zip 9.0 2013-05-13 7.0 David Fishburn NF: Added new option, g:outlook_always_use_unicode, to override Outlook and force all emails to use utf-16le fileencoding.

NF: Added new option, g:outlook_scan_email_body_unicode, to override whether messages will be scanned for unicode characters.

NF: Added new option, g:outlook_debug, to turn on messages displayed to both Outlook and Vim.

NF: Updated some of the messages displayed to be more informative.
BF: Editing unicode emails did not reliably work with OutlookVim.

BF: Unicode detection was not always correct in the Outlook Basic file.

BF: Updated the codepage which Vim expects unicode messages from Outlook to be encoded in (András).

BF: Added some additional changes to the VB code to support both 32-bit and 64-bit platforms (Paul).
outlookvim_v8.zip 8.0 2013-02-01 7.0 David Fishburn New Features
- When preparing to edit an email in Vim, OutlookVim.bas will query the Vim instance checking to see if multibyte support is enabled in Vim.  It does this by checking to see if a bomb is enabled (:set bomb) and the value of fileencodings (:set fileencodings) to see if ucs-bom or any utf strings have been specified.  If multibyte is enabled, then the file created by OutlookVim.bas will be saved in unicode.  If your Vim is not setup to edit unicode files, Outlook will not enable the unicode format.
outlookvim_v7.zip 7.0 2012-10-10 7.0 David Fishburn NF: Added support for Outlook 2010.

NF: Added documentation on how to self sign the Outlook Vim macro so that security settings do not have to change in Outlook to use the macro.  Changing these settings are not possible in some companies.
outlookvim_v6.zip 6.0 2012-02-21 7.0 David Fishburn Bug Fix
- Changed how the script looks for some system files especially useful if you do not store your vimfiles directory in the $VIM directory (Adam Duck).
outlookvim_v5.zip 5.0 2010-08-14 7.0 David Fishburn New Features
- Changed how the script looks for some system files especially useful if you do not store your vimfiles directory in the $VIM directory (Adam Duck).
outlookvim_v4.zip 4.0 2010-06-04 7.0 David Fishburn New Features
- Updated documentation.  Added a troubleshooting section (Zsolt Botykai).
- Updated outlookvim.js to display a message if double clicked on to determine if Windows Script Host is correctly installed.
- Updated outlookvim.bas (the Outlook VBScript Macro) to show an error if it cannot access the file system.  Modified all the message boxes Outlook may display to indicate "OutlookVim:" is displaying the message.
- You can specify whether new emails should be opened in a new tab via the g:outlook_use_tabs configuration option (Zsolt Botykai).

After unzipping the contents into your vimfiles directory, copy and paste the outlookvim.bas file into your Outlook macro created earlier (ALT-F11 in Outlook).

Also from within Vim run (choose the location where the plugin was installed):
:helptags $VIM\vimfiles\doc
outlookvim_v3.zip 3.0 2010-05-10 7.0 David Fishburn New Features
- You can specify which Vim instance to edit the file by setting a variable in your .vimrc (i.e. let g:outlook_servername = 'OUTLOOK')

Bug Fixes
- For some (international?) Windows versions, there were errors when (or a failure) editing the file.  Needed to escape the backslashes of the filename.
outlookvim_v2.zip 2.0 2010-05-07 7.0 David Fishburn This version adds support for Microsoft Outlook 2007 as well as earlier versions.
Documentation improvements.
outlookvim_v1.zip 1.0 2010-05-07 7.0 David Fishburn Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.