vim & python

poiboy bitbucket at safe-mail.net
Mon Mar 1 20:48:17 EST 2004


Look at taglist.vim (links below), a popular souce-browsing Vim
script. It's the only major script I'm using right now. I don't know
of any definitive Python calltips available for Vim (I assume they
would be difficult with flexible parameters and return values), but
taglist.vim provides function prototypes in the form of parameter
lists (search for 'prototype' in the taglist docs).

I've tried a few nifty Python-specific scripts (search www.vim.org)
but always wound up forgetting the special commands and resorting to
Vim staples. For example, the following two lines in my .vimrc were
good enough to condense all the functions and classes in a file:

    set foldmethod=indent
    set foldnestmax=2

My .vimrc also includes this "execute code and output results in new
buffer" script (which should all be on one line):

    map <F4> :w<CR>:let @a = system('`which python` ' .
bufname('%'))<CR>:silent botright new output<CR>:silent normal "aP<CR>

Normally I use GVim next to a terminal window tabbed with IPython
(ipython.scipy.org/) and a browser tabbed with whatever documentation
I may need - Python docs, RFCs, and project docs
(epydoc.sourceforge.net/). IPython helps access the nitty-gritty
aspects of Python, Epydoc allows me to browse documentation and
package structures elegantly. And though I am by no means a Python
guru, I've posted a screenshot of my "modular IDE" in action (link
below).

I went through a do-it-all-in-Vim stage and left feeling as though I
had just spent too much time playing with my tool. Keeping a browser
and terminal open all the time anyway, I eventually dismissed the
all-in-one paradigm as some quixotic jab at Emacs.

Happy vimmings,
poiboy

taglist.vim
http://www.vim.org/scripts/script.php?script_id=273

exuberant ctags
http://ctags.sourceforge.net/

screenshot
http://aonalu.makahavalley.org/img/gvim_konq_ipython.png (197K,
1600x1200)
Check out the function prototype on the bottom of GVim's window.



More information about the Python-list mailing list