- to build vim as a bonobo component, you'll need the latest vim-bonobo patch from here.
- to build evolution with support for using an alternate editor, you'll need the the appropriate patch from here, depending on which version of Evo you're building.
I've put together an apt-repository containing vim-bonobo and evolution (version 2.2.2) packages for i386. Just add the following line to your /etc/apt/sources.list:
deb http://www.opensky.ca/~jdhildeb/debian/ unstable/and then run:
apt-get update apt-get install -t unstable evolution=2.2.2-4jh1 apt-get install -t unstable vim-bonobo
Building Vim with Bonobo Support
Here are the basic instructions for getting Vim built with bonobo support:
- recent GTK2 and Gnome development libraries
- autoconf 2.12 or 2.13 (2.5x versions do not work!)
- Check out a copy of Vim from CVS
- Now get the latest vim-bonobo patch from here and apply it to the vim source tree. If it doesn't apply cleanly, you have two options:
- Pester me to release an updated patch.
- Do "cvs -z3 -d:pserver:firstname.lastname@example.org:/cvsroot/vim co -D '2004-06-15' vim" to get a snapshot of the Vim source from the same date as the patch
- go into the vim/src directory and run "autoconf2.13" to generate the configure script.
- Configure vim for Gnome and Bonobo support and run make. Note that the Vim_Control.server file must end up in a directory where your bonobo-activation-server will find it. On my system gnome is installed under /usr (not /opt or /usr/local), so I need to pass --prefix=/usr to configure.
./configure --enable-gui=gnome2 --enable-bonobo --with-features=big make
- Most people will want to install vim-bonobo in parallel with other (non-bonobo) Vim installs. Assuming you have a non-bonobo vim already installed on your system, use the target "installbonobo" to install just the binaries and bonobo server file (not all the runtime files, etc.).
- You will likely need to kill your bonobo-activation-server so that it will restart and become aware of the vim component (it will be restarted automatically -- no need to do anything).
kill `pidof bonobo-activation-server`
Using Vim with Evolution
- install a copy of evolution which has the above patch applied to enable setting an alternate editor. Your options are:
- build vim with the vim-bonobo patch applied, as described above, and install it.
- you need to have the "html2text" program installed (should be available in your distro).
- To tell Evo to use vim, start Applications->System->Configuration Editor (or start "gconf-editor" from command line), and navigate to the "apps/evolution/mail/composer" key. Edit the sub-key entitled "editor_oafiid" (create it if necessary), and set the value to "OAFIID:Vim_Control". If you ever want to return to using the GtkHTML editor, you'll need to delete the "editor_oafiid" key.
Now Evo should use Vim for editing emails -- give it a try! You'll want to do a couple more things, though. You can write a Vim function called "EvoQuote" which will be called to quote text in the emails (i.e. when replying), and put it in your .gvimrc file. The following function prefixes each quoted line with '> ':
function! EvoQuote() normal msHmt %g/^GtkHTML_QUOTE_ON/.,/GtkHTML_QUOTE_OFF$/s/^/> / %g/^> GtkHTML_QUOTE_ON/.,/^> GtkHTML_QUOTE_OFF$/s/> /> / %g/^> GtkHTML_QUOTE_ON/d %g/^> GtkHTML_QUOTE_OFF/d normal 'tzt's endfunction
(Thanks to Rob Hill for contributing this improved version of my original function).
If you want to set some different vim settings when editing emails (I typically set nocindent and reduce the textwidth to 76 characters), add the following to your .gvimrc as well:
" set email settings when embedded by evolution " don't give a warning if this event is unknown try autocmd EmbeddingOn evolution* :so ~/.vim-evo catch /E216/ endtry
This will cause the ~/.vim-evo file to be sourced whenever an embedded vim instance is started by evolution. The try/catch is necessary because non-bonobo versions of vim will not recognize the EmbeddingOn event. Put any evo-specific vim settings you want into ~/.vim-evo.
Now before you do any real work, send yourself a few test emails until you are sure it is working properly.
Gnome-vim partially implements the GtkHTML interface so that it can be used from Evolution without requiring changes in how Evolution uses the editor.
Most bonobo factories are located in the same executable as the controls they produce. But most factories can produce multiple controls which all live in the same executable. This is not the case for Vim: it's only possible to have one control per process. Because of this, the factory has been implemented as a separate executable, as per the "proxy" option described in this message.
I'm Jason Hildebrand <jason at peaceworks dot ca>. Please send bugfixes, patches and suggestions.