created April 3, 2008 · complexity basic · author Srepmub · version 7.0
IPython and Vim make for a great IDE. The following shortcuts can help to make it even better.
To also avoid having to enter a test command in IPython, I use konsole and dcop to send the command to IPython automatically. In the following, ' is mapped to run the command 'r' in IPython. First, start IPython as follows:
konsole --script ipython
Next, add the following mapping to vimrc:
nnoremap ' :wa<CR>:!dcop konsole-`pidof konsole` session-1 sendSession r<CR><CR>
I wanted to make this work in gnome-terminal as well, but couldn't figure out how to do this with DBUS. So here's a nice trick to make it work in any terminal that supports the 'screen' utility. First, create a 'virtual' screen named 'blah':
screen -S blah ipython
Now to send a command to the 'blah' screen:
nnoremap ' :wa<CR>:!screen -x blah -X stuff $'r\n'<CR><CR>
To start screen with gnome-terminal:
gnome-terminal -e 'screen -S blah'
Please feel free to add more tips for integration with IPython below.
Does anyone know of a solution to use Ipython+Vim under Windows?