Silly question; best way to run a python program from Vim?

Kenneth McDonald kenneth.m.mcdonald at sbcglobal.net
Sat Jun 12 00:35:26 EDT 2004


After looking around at various editors, I've finally decided on
(I think :-) ) Vim for my future work. (jed is a great editor,
but doesn't do neat things like allow me to write python code
to add to the editor functionality. Emacs is just too bloated
these days. jEdit is one of the best GUI editors I've seen, but
I've still not seen a GUI editor with the power of those with
a non-GUI ancestry. etc. etc.)

However, I can't quite figure out how one 'should' excute
the Python program one is currently working on in Vim. I'm
aware of the :python and :pyfile commands, but they seem to
be oriented towards running scripts which are intended to
do editing tasks, i.e. which interact with Vim. I simply want
to do something like

:runthissucker

to execute the current file under python, pop up a window
with the results, automatically take me to the point in 
the buffer (or other file) where an error was encountered,
etc. In other words, I want to run the program as part of
the development process of that program, not as an addon to
Vim. (Looking back, that isn't terribly clear, but it's about
as clear as I can think to make it right now.) Using 'jed'
and the standard jed python mode, this was just '^C^C', but
from what I understand of the python functionality of
Vim, I currently have to do something like

:python my_file.py

Thanks for the help. Of course, if you have other useful
suggestions for using Vim with Python, please feel free
to contribute those also.

Cheers,
Ken



More information about the Python-list mailing list