Python IDE

Evan Klitzke evan at yelp.com
Wed Jun 20 00:43:56 EDT 2007


On 6/19/07, Bjoern Schliessmann
<usenet-mail-0306.20.chr0n0ss at spamgourmet.com> wrote:
> BartlebyScrivener wrote:
> > VIM
>
> *clap-clap*
>
> BTW, are there tutorials on the more arcane vim functions that come
> in handy with Python?

I don't know of any vim functions that are python specific, but to me
the two somewhat arcane things that are really important to using vim
efficiently in programming in general are window splitting and
folding.  Folding can be immensely useful for moving through files and
keeping important information visible.  Ctags is also useful -- it
lets you jump to where the class/function under the cursor is defined.
Window tabbing is also new as of vim 7, but I prefer window splits.
You'll probably want to write some vim macros to help you use the
window splits more efficiently (e.g. to to move up a split and
maximize it in one key stroke).

There's a script on vim.org for using the unittest module with the
:make command, which is also useful if you use that module a lot. And
of course if you build vim with python support, you can script vim
using python!

Another thing I've noticed is that there are a couple of different
work flows that people have for testing code they're writing in vim.
The simplest way to run a script is with ":!python %" (sans quotes),
which runs the script with the output going to vim which pretends to
be a terminal.  I think this is sort of suboptimal because vim isn't a
real terminal so some programs will act strangely this way. The
workflow I have is a screen session with vim in one (or more)
"windows" and another "window" that is just a shell, which I run my
scripts in. Another method that I've seen is to just background vim
with Ctrl-Z, run the program, and then foreground the vim session to
go back to the code. Either way, I think running your session in
screen is really, really useful because you can do a search through
the screen buffer for occurrences of certain words (I tend to do a
backwards search, with Ctrl-a [ ?search_term), which can help you
search through the output of your program quickly when things go awry.
IF you're a fan of screen (or want to use it), I have a pretty nifty
.screenrc that I use that shows the screen "windows" on a status line
at the bottom with some other nifty information (the hostname of the
machine screen is running on, the load information, and the time) as
well, plus support for 256 colors, which lets you use those nice 256
color vim colorschemes. If you're interested you can grab it at
http://eklitzke.org/files/.screenrc

-- 
Evan Klitzke <evan at yelp.com>



More information about the Python-list mailing list