vim-ipython two-way integration! (updated: 2011-08-02)

I’m very pleased to share with you a demo the forthcoming vim-ipython integration which will work with IPython 0.11(trunk).

You can either use the Flash player below, or download the OggVorbis file (14MB) update: vim-ipython ‘shell’ demo (9.6MB). The blog-free form of this post is here.

If you like what you see and want to try it, you can get the details from the vim-ipython github page and it currently requires 4 line changes to IPython, which are currently in this pull request. (Fixed to work on IPython trunk with no changes).

Big thanks to Min for walking me through the new IPython kernel manager during the SciPy2011 sprints.

UPDATE: 2011-08-02

vim-ipython ‘shell’ mode.

Just in case, here are the same videos as above, but hosted on Youtube:

If you’re have any issues, try searching for your error on the vim-ipython github issues page, and if you don’t find it, please file a new one, and I’ll help you out there.

Tags: , , , ,

19 Responses to “vim-ipython two-way integration! (updated: 2011-08-02)”

  1. Nice, very, very nice. (And that post did make it to planet scipy :>)

  2. phoowkaspo says:

    Does this depend on X? Does it ( or could it ever ) work on MS Windows?

    Great demo!

    • Paul Ivanov says:

      it uses vim and ipython – the only tricky bit is ipython has to be installed with zeromq/pyzmq enabled – but everything is cross platform and should work in Windows.

  3. Peter says:

    Nice work!

    If you run some code with Ctrl-S, is it possible to show the code and output in the ipython window?

    • Paul Ivanov says:

      There’s nothing preventing that, but I’ve got it working the other way right now. I’ve added a vim-ipython ‘shell’ buffer that shows all of the In[] Out[] prompts regardless of where it was typed (from vim or in the qtconsole).

      The qtconsole should do as you say – it just hasn’t been patched with this capability yet.

  4. Both “download it in OggVorbis format” links are to the same `vim-ipython-shell.ogv` file.

    Thanks for your work!

  5. gao says:

    I have installed pyzmq-2.1.9,and “import zmq” is right, but when i use gvim “:IPythonClipboard” an error occures:”Import error:IPython.zmq requires pyzmq >2.1.4″.why?

  6. Paul Ivanov says:

    Here’s a quote from the readme, it’s likely one of these two issues:

    1. your sys.path in vim differs from the sys.path in regular python. Try running these two lines, and comparing their output files:

    $ vim -c ‘py import vim, sys; vim.current.buffer.append(sys.path)’ -c ‘:wq vim_syspath’
    $ python -c “import sys; f=file(‘python_syspath’,'w’); f.write(‘\n’.join(sys.path)); f.close()”

    or

    2. your vim is compiled against a different python than you are launching. See if there’s a difference between

    $ vim -c ‘:py import os; print os.__file__’ -c ‘:q’
    $ python -c ‘:py import os; print os.__file__’

    if that still doesn’t help, please file a bug on the vim-ipython github page

  7. Shi says:

    Great demo!
    I am just wondering how do you visualize the key strokes on the screen?
    Thanks :)

  8. Legout says:

    Hi,

    your integration of Ipython into vim looks amazing. However, I can´t get it to work. That´s what I´ve done:
    1. Installed it and all commands are available in vim
    2. Tried to connect to a running Kernel rises the following error:
    :IPython kernel-37371.json failed
    ^– failed –shell not specified

    What is wrong?

    Thanks

    • Paul Ivanov says:

      I think you might be using an old version of vim-ipython. If you’re using the latest version of vim-ipython (the one from GitHub), then it looks like you’re pulling in an old version of IPython. Either way, can you file an issue for it on the vim-ipython github page, and I’ll help you out there (or you can document what you did to make it work for the benefit of others). Thanks!

      • Legout says:

        Hi Paul,

        thanks for your reply. I was able to solve my problem. It was because I used an old MacVim Version, which was still available on my Mac although I have upgrade to the a newer version. Now everything works fine.

        Thanks!

  9. Scott Carr says:

    Awesome project! Kudos to you.

    I see on the github page, it says that “ipdb support is not yet re-implemented.” Does that mean ipdb will work with vim-ipython eventually? That’d be great.

    Right now, if I put in a pdb break point it freezes the ipython kernel. I take it that is expected for now?

    Thanks

    • Paul Ivanov says:

      that’s right, back in IPython 0.10 and prior, I used to use ipdb from vim all the time, so it’s on my todo list to get this functionality back into vim-ipython.

Leave a Reply


six + 2 =