Alcott
Alcott

Reputation: 18575

how to send code to ipython from vim

Frankly speaking, I want an integration of vim and IPython, and I know there is such a great vim plugin vim-ipython, I indeed tried this, but it doesn't work out on Windows7 and tried to make it work (non-trivial thing, little documentation about it, failed and gave up).

Now I want to know if it's possible to connect a running ipython kernel from vim and send code to it?

Upvotes: 1

Views: 1621

Answers (1)

George Karpenkov
George Karpenkov

Reputation: 2124

I had something very similar running at some point. It's not a clean solution in a sense that there is no Vim/IPython integration (as far as I know given the way Vim core is written such integration is unlikely to happen) but it did work.

  1. Install tmux terminal multiplexer (http://tmux.sourceforge.net/)
  2. Launch two tmux panes inside the terminal, one for Vim, one for IPython
  3. Install vim-slime plugin, configure it to use tmux (http://technotales.wordpress.com/2007/10/03/like-slime-for-vim/, https://github.com/jpalardy/vim-slime).
  4. Now, whenever you'll select some code in Vim and press the slime shortcut (C-c C-c by default) it will be sent to the IPython session and executed.

I think this will get the behavior you want. It's also agnostic to IPython and can be used with any REPL environment.

Upvotes: 4

Related Questions