[Tutor] Invoking Python from Vim

Matt Smith matt at mattanddawn.orangehome.co.uk
Fri Jun 8 00:06:08 CEST 2007


Hi,

Bit of a Vim specific question this one but I hope someone might have an
answer. I currently have the following line in my .gvimrc file (I'm
using Ubuntu Linux):

map <F2> :!gnome-terminal -e=python\ -i\ %<CR>

This opens a window and runs the Python program I am working on. I don't
really like the fact I can't do anything else in vim until I close the
window and I don't really need the interactive prompt that I am left
with. If I invoke Python without the -i then I don't get to see the
error message if my program exits with an error.

In 'normal' vim I use:

map <f2> :w\|!python %<cr>

This doesn't work for GVim which I prefer to use.

Do any Vim users have a better way of running a Python program while it
is being edited in Vim?

Thanks,

Matt




More information about the Tutor mailing list