Once you've started using Vim you quickly wish that you could use it for every form of text input. At work however I'm forced to work with Windows and MS Office and some other tools which are far from the convinience of Vim. Escpecially Outlook drove me nuts because I often hit Escape and trashed an email draft by accident.

After some research and a couple of trial and error tests I finally found a working solution to be able to use Vim everywhere. This solutions are an Outlook Plugin called OutlookVim[1] and an AutoHotkey[2] script called "Edit everywhere with vim"[3].

I'll explain first the Outlook Plugin because it's a bit more complicated to install than the AutoHotkey Script.

First download the zip and extract it's content to your vim files. Either in your documents folder or in Vim's install folder. To be able to use OutlookVim you need to add this line to your .vimrc file.

set nocompatible

Next open Outlook and follow the instructions. The instructions are copied from the documentation of the OutlookVim plugin. For other Outlook versions please have a look at the plugin documentation.

  1. Macro security Outlook 2010
    • From the Outlook menu File -> Options -> Trust Center (left pane) -> Trust Center Settings (Button, right pane) -> Macro Settings
    • Depending on what security settings your company enforces you can either "Enable all macros" or choose "Notifications for all macros" and you will be prompted once each time Outlook is started.
    • See step 16 below.
  2. From the menu Tools->Macro->Visual Basic Editor (or Alt-F11)
  3. From the menu File->Import File (or Ctrl-M)
  4. Choose the file ...\vimfiles\plugin\OutlookVim.bas (depending on where you installed the plugin).
  5. Expand the Modules folder in the Project pane
    • Right click on Module1 and choose Project Properties (if available)
  6. You may have to click on the top level folder (VbaProject.OTM)
    • Right click on Module1 and choose Project Properties (if available)
  7. Change the project name to "Vim"
  8. Change the project description to "Edit emails with Vim", hit Ok
  9. From the menu File->Save (or Ctrl-S)
  10. Close the Visual Basic Editor
  11. Double click on an email
  12. Adding toolbar buttons to a new email window Outlook 2010 / 2013
    • There are 2 ways to add icons, in the "Ribbon" where the usual icons are, or in the "Quick Access Toolbar" which is at the very top of the email, in the titlebar
    • Adding a Vim Group and icons to the Ribbon
      • Right click on the far right of the toolbar and choose "Customize the Ribbon"
      • Change the "Choose commands from" to "Macros"
      • In the right side, make sure "Main Tabs" is selected at the top
      • You must choose where and how you want to place your Vim icons, here is what I choose.
      • Highlight the "Message" item in the list, should be at the top
      • Click on the "New Group" button
      • Rename the new group to "Vim" (by right clicking)
      • Now you can choose which Vim icons on the left pane should be added to the new group we have just created
      • Vim.Edit should be displayed, add it using the "Add >>" button
      • Click the Vim.Edit button in the right pane and click the "Modify" button below
      • Here you can assign some icon to it that will be easily recognisable
      • Hit Ok
      • You may need to reopen the email
      • Click on the new button you added in the Quick Access Toolbar (which is located at the very top near the title bar)
    • Adding a Vim Edit icons to the Quick Access Toolbar
      • Toolbars are not editable in Outlook 2010 / 2013
      • A new Quick Access Toolbar has been introduced in the titlebar of the open email
      • Right click on the far right of the toolbar and choose "Customize Quick Access Toolbar"
      • Change the "Choose commands from" to "Macros"
      • Vim.Edit should be displayed, add it using the "Add >>" button
      • Click the Vim.Edit button in the right pane and click the "Modify" button below
      • Here you can assign some icon to it that will be easily recognisable
      • Hit Ok
      • You may need to reopen the email
      • Click on the new button you added in the Quick Access Toolbar (which is located at the very top near the title bar)
  13. Make a minor change to the email (in Vim) and :w
  14. Verify the Outlook email has the same change
  15. Hit Escape to close the Outlook email, you will be prompted to Save the changes you have just made. So you always have an option of cancelling the changes you made in Vim, in Outlook.

One problem which I experienced by using this plugin was that the text looses all it's formating. Which can be a bit of a pain if you're required to have a signature with links in it. At the moment I'm still looking for a solution.

This step is much easier than installing the Outlook plugin.

  1. Download and install AutoHotkey
  2. Create a new AutoHotkey by right clicking in the folder where you want to store your script.
  3. Copy the code from this post[4] and save the script. I've made a minor change so that the script starts now Gvim instead or the normal Vim. The reason for this was that with normal Vim I had problems with Umlauts. They looked fine in Vim but in the applications like Word they got changed to other characters.
  4. Create a shortcut to the script in your autostart folder to ensure that the script is ready after a reboot.
  5. Enjoy Vim in every application.

Next Post Previous Post