[Tutor] Invoking Python from Vim

Tim Johnson tim at johnsons-web.com
Fri Jun 8 00:49:34 CEST 2007


On Thursday 07 June 2007, Matt Smith wrote:
> 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.
  Hi Matt:
     I've just started using gvim for python after several years
     of using xemacs for python programming.
     Currently I'm using vim.python on kubuntu 7.04 with the
     python interpreter embedded, along with the taglist.vim
     and python_box.vim plugins. They go a long way towards
     an "IDE" for python. python_box has two methods to test
     and execute whole files. You can also test simple python
     code snippets from ex as in
     :python help(dict)

and I've barely begun to scratch the surface .....
Tim



More information about the Tutor mailing list