Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tag: 6.0
Fetching contributors…

Cannot retrieve contributors at this time

344 lines (279 sloc) 14.906 kB
*outlook.txt* For Vim version 7.0. Last change: 2011 Mar 28
VIM REFERENCE MANUAL
by
David Fishburn <dfishburn dot vim at gmail dot com>
Outlook Vim Plugin
outlook.vim version 6.0
For instructions on installing this file, type
:help add-local-help
|add-local-help| inside Vim.
Homepage: http://vim.sourceforge.net/script.php?script_id=3087
*outlook*
*outlookvim*
1. Overview |outlook-overview|
2. Whats New |outlook-new|
3. Installing the plugin |outlook-install|
4. Installing the Outlook macro |outlook-macro|
5. Configuration |outlook-configuration|
6. Troubleshooting |outlook-troubleshooting|
{Vi does not have any of this}
==============================================================================
1. Overview *outlook-overview*
This plugin has two parts.
Outlook
-------
Outlook includes a feature which allows macros to be created in Visual Basic.
Once the macro is imported / created, you can create buttons and place them
on Outlooks email toolbars. The macro (when executed) does two
things:
1. Writes the email body out to a file ending in .outlook
2. Writes out a control file ending in .outlook.ctl
Vim
---
The outlook.vim plugin is responsible for setting up some autocmds inside
of Vim. There are a number of configuration options which allows you to tweak
the behaviour of the plugin. The autocmds also set the Vim filetype to "mail"
which allows you to customize even further using the usual Vim filetype plugins.
These autocmds are responsible for updating Outlook when the buffer (email) is
updated. Communication with Outlook is via the Windows Script Host (WSH
http://en.wikipedia.org/wiki/Windows_Script_Host) automation technology from
Microsoft.
The autocmds will execute the outlookvim.js (javascript) file which uses
the .outlook.ctl file to determine which email to update and places the
contents of the .outlook file into the body of the message in Outlook.
It then deletes these temporary files when finished.
The autocmds also will delete the temporary files if you choose to abandon
the changes (in Vim) by using :bdelete, :bwipe or closing Vim.
After creating the Outlook macro and installing the Vim Outlook plugin, no
other changes are required except editing and saving your emails.
There are a number of configuration options available see
|outlook-configuration|
If you have questions or suggestions you can post questions to the Vim mailing
list. I routinely monitor the list. Comments, feedback and suggestions are
always welcome.
David Fishburn
==============================================================================
2. What's New *outlook-new*
Version 6.0
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).
Version 5.0
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).
Version 4.0
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).
Version 3.0
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.
Version 2.0
New Features
------------
- Working with Outlook 2007 and first official release.
- Documentation updates.
Version 1.0
New Features
------------
- Initial release.
==============================================================================
3. Installing the plugin *outlook-install*
You can use this script as a plugin by copying it to your plugin directory.
See |add-global-plugin| for instructions.
You can also |:source| it from your |.vimrc|.
To install this help file |add-local-help| inside Vim.
:help add-local-help
:helptags $VIM/vimfiles/doc (Windows)
Files used by the plugin:
outlook.vim
- Sets up autocmds which are activated when editing a file
which ends in .outlook
outlookVim.bas
- Visual Basic code used by Outlook to create some temporary files
and launch Vim.
outlookVim.js
- A Javascript file called by the Vim autocmds when the file is saved.
It uses Outlook APIs to update the email within Outlook.
outlook.txt
- This document
NOTE:
Vim must be in nocompatible mode for the plugin to operate correctly.
This implies you have this line in your |.vimrc|: >
set nocompatible
<
==============================================================================
4. Installing the Outlook macro *outlook-macro*
The macro is used to add a button in Outlook to lauch Vim. It is used to
create the files which Vim will edit. It will also add a shortcut key
(Alt-d) to fire up Vim instead of having to use a mouse.
To install the Outlook macro flip over to Outlook.
1. From the Outlook menu Tools->Macro->Security
Outlook 2003
- Make sure this is set to Medium, or the macro will not be enabled
Outlook 2007
- Make sure this is set to Warnings for all macros
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 (where ever you
installed the plugin).
5. Expand the Modules folder in the Project pane
6. Right click on Module1 and choose Project Properties
7. Change the project name to "Vim"
8. Change the project description to "Edit emails with Vim"
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
Outlook 2003
- Right click on the toolbar (of the email message) and choose
"Customize"
- Choose the Commands tab
- Click on the Macros category
- Drag and drop the Vim.Edit macro onto the end of the Standard
toolbar displayed in the currently open email
- Click on the Rearrange Commands button
- Change the radio button to Toolbar: Standard
- Scroll to the bottom where the Vim.Edit button is and highlight it
- Click on the Modify Selection button
- On the dropdown which appears, click on Name
- Change the name from "Vim.Edit" to "Vim.E&dit"
- Now you can press Alt-d as a shortcut to launch Vim to edit
the email without having to use the mouse to click on the
button (after all, that is the Vim way)
- Hit Enter, Close and Close to return back to the open email
- Click on the Vim.Edit button, or hit Ctrl-d to edit the email using Vim
Outlook 2007
- Toolbars are not editable in Outlook 2007
- A new Quick Access Toolbar has been introduced in the titlebar
of the open email
- Click on the far right and choose "Customize Quick Access
Toolbar"
- Click on "More Commands..."
- 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
- Click on the new button in the Quick Access Toolbar
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.
If you changed the Macro Security settings you must restart Outlook
for these changes to be active. If you are prompted when you restart Outlook
on whether it should enable Macros, these pages might be useful to figure out
how to sign your macro: >
Macro Security settings and creating digit certificates
http://www.pcreview.co.uk/forums/thread-854025.php
<
I haven't tried the above. If you do manage to accomplish this, please email
the author with some instructions and I will include this in a future release.
NOTE: You are only prompted once per session if Macros should be enabled.
==============================================================================
5. Configuration *outlook-configuration*
The behavior of outlook.vim is governed by several variables. These variables
are used by the autocmds which are created by the plugin. These variables can
be assigned global defaults which can be set in your |.vimrc|.
You can override many of the features of this script by creating various
variables within your vimrc.
The outlookvim.js (javascript) file tells Outlook to re-read the message from
the temporary file. This allows you to rename it, or place it in any
location you want. Here are some examples: >
let g:outlook_javascript = '$VIM\vimfiles\plugin\outlookvim.js' (default)
let g:outlook_javascript = 'C:\Documents and Settings\Username\My Documents\outlookvim.js'
let g:outlook_javascript = expand('$APPDATA\Microsoft\outlookvim.js')
let g:outlook_javascript = expand('$USERPROFILE\Application Data\Microsoft\outlookvim.js')
<
This setting (default = 0) will force all emails to be edited in a new
tab in Vim. >
let g:outlook_use_tabs = 1
<
This setting (default = '') will force all emails to be edited in a particular
Vim instance. If the instance has not be started, a message is displayed
with an example command line to start an appropriate Vim. >
let g:outlook_servername = ''
<
This setting (default = 1) overrides the default textwidth the mail ftplugin sets. This
allows you to automatically format text using gq by setting the following: >
let g:outlook_textwidth = 76
<
When you save a file, by default, Outlook will be updated and the temporary
file you are editing will be deleted. Autoread was added so that the Vim
buffer is automatically cleared instead of displaying a warning message
indicating the file has changed outside of Vim (in fact it was deleted). If
you wish to see the warning, you can set (default = 1) the following: >
let g:outlook_noautoread = 1
<
When you save a file, by default, Outlook will be updated and the temporary
file you are editing will be deleted. Since the file has been deleted, you
are left editing a file that no longer exists. By default, the Vim buffer
will be deleted automatically, unless this option (default = 1) is set.
If you want to be able to save the file multiple times before removing the
buffer from Vim, set the following: >
let g:outlook_nobdelete = 1
<
If you do not save the temporary file and instead decide to throw away your
changes, the temporary files will be cleaned up. This option (default = 1)
will leave the files in the temporary directory instead of removing them. >
let g:outlook_nodelete_unload = 1
<
This setting (default = 1) will prevent the script from automatically turning
on Vim's autoindent feature. It will use your default setting instead. >
let g:outlook_noautoindent = 1
<
This setting (default = 1) will capture the output when attempting to update
Outlook. >
let g:outlook_save_cscript_output = 1
<
This setting (default = 1) will show any errors reported when attempting
to update Outlook. This debugging output should help identify where
any problems may lie. >
let g:outlook_view_cscript_error = 1
==============================================================================
6. Troubleshooting (various versions of Windows) *outlook-troubleshooting*
If you're Outlook macro does not work at all (or opens a Vim (GUI) window
but without proper contents/filename), you should check your Internet
Explorer's security settings.
Go to IE => Tools => Options => Security tab => Custom level and check if the
various ActiveX components are allowed to run.
If they are enabled, and the Outlook macro still does not work, your Windows
Script Host (WSH) might not be installed correctly. To test this, open Windows
Explorer (not Internet Explorer) and navigate to where your Vim plugins
are installed. Find the plugin\OutlookVim.js file and double click on it.
This will launch the javascript file and a Message Box should popup saying: >
"Hello from OutlookVim!"
<
If the Message Box is not displayed or some other error is displayed, your
Windows Script Host (WSH) might not be installed correctly. You may want to
reinstall WSH by following the Upgrade links found at the WSH home page. >
http://msdn.microsoft.com/en-us/library/9bbdkx3k.aspx
<
The following has solved the problem for at least one user on a Windows XP
system using Outlook 2003. Re-registering the Windows Script Host's DLLs.
Hit the *Win+R* keyboard combination and run these 2 commands (separately): >
regsvr32 wshom.ocx
regsvr32 scrrun.dll
<
If the above does not help, or if you receive an error message when running
the two commands above, then you may need to contact Microsoft Support.
==============================================================================
vim:tw=78:fo=tcq2:ts=4:ft=help:norl:
Jump to Line
Something went wrong with that request. Please try again.