Program Python in VIM

Alan Gauld alan.gauld at btinternet.com
Thu Jan 22 16:24:50 EST 2004


On Thu, 22 Jan 2004 19:08:33 +0000, Paul Moore
<pf_moore at yahoo.co.uk> wrote:
> Peter Wu <peterwu at hotmail.com> writes:
> > vi test.py
> > [key in some python code]
> > :wq

You should only need :w here. The q will close the window which
presumably you don't want?


> > :!python test.py
> >
> >
> > Is there any other way? I don't want to type 'python test.py' every time

:!!

repeats the last command.

However if you are using vim in a *nix terminal rather than the
GUI version you could use CTRL-Z to suspend vim then run python
foo.py from the shell prompt. Resume python, edit and CTRL Z
again. !! at the prompt will repeat the last run command.


> > ...In Emacs, I can simply fire C-c C-c to fire

:!! is probably the nearest direct equivalent.

Alan G.
Author of the Learn to Program website
http://www.freenetpages.co.uk/hp/alan.gauld



More information about the Python-list mailing list