Monday, April 5, 2010

GVIM+IPython with Conque plug-in

Here is an alternative way to bridge (G)VIM and IPython applications. GVIM is my editor-of-choice and IPython is a great interactive Python interpreter. If you are a user of these two environments, this simple integration technique could greatly boost your programming / prototyping speeds.

First go to conque (Thanks to Nico Raffo for the plug-in and helping me to include IPython functionality in it) page and install the plug-in following the simple installation instructions. (In my Fedora 12 system, I pulled the latest tar.gz package from the download list section and extracted it under ~/.vim folder.) Next grab the latest conque_term_pylab.vim file from the same section and place under ~/.vim/plugin directory.

When you open a simple Python script you can easily launch an "IPython -pylab" instance by hitting F6 and execute the whole script content by F8, use F9 to send a visual selection. The IPython inside the buffer acts as a part of GVIM, so you can easily switch between buffers and copy/move text from/to buffers. You can modify the IPython switch, default window position, mapped keys editing conque_term_pylab.vim

The screenshot below shows the bridge in action:

Hint: Add the following line into your vimrc file to get equally spaced buffer windows independent of the main GVIM window size.

autocmd VimResized * wincmd =

Currently only %run magic of IPython is implemented. Here are some of the ideas that could be added to improve this IPython + VIM integration:
  • Add %whos key-mapping
  • Launch IPython -pylab on start-up automatically if a Python script is opened.
  • If "run" command is sent before an IPy launched instantiate one automatically.
  • Make sure only one instance of IPython is running!
  • GUI integration, create GVIM menus, reading %whos values back into a separate window and changing values.
These last points could be well achieved by working on PIDA project. It is very possible to have an VIM + IPython powered IDE that is especially suited towards scientific use.


  1. Uses the "termios" module, so *nix only. No MS Win suppport, sadly. Thanks, though!

  2. This is pretty awesome. I do have one suggestion though; you should make the -pylab arg to ipython depend on a g: var (since not everyone requires it; you could just also generalize this and have a var for args to pass to ipy on startup). Thanks again for sharing this.

  3. anybody know if anything like this ( IPython plus gvim) for us MS Windows slobs?

    I'm begging here.

  4. Sorry, no Windows support for the time being. Please fill a port request at You might convince Nico to write a port for Win.

    @2nd Anonymous,

    Could you please send your generic version? I use pylab almost all the time, but it might be a good idea to have something more generic than my use.

  5. Hi, this is Nico, the developer of the ConqueTerm project. I am holding off on a Windows version until GVim.exe is compiled against Python 2.5+ by default, so I can use the ctypes modules. I'm hoping this will happen with Vim 7.3.

    In the meantime you could try this plugin:

    I personally couldn't make it work the first time I tried it, but the demo looks terrific.