Yesterday I was talking about Python programming at home with the guys that came for Pycon. We were discussing terminal background colors, favorite editors, web frameworks, and so on, and I mentioned that I have a hard time navigating deep Python code on vim, which is what I use for development. Goran reminded me of ctags, which I learned some 15 years ago. Turns out it's pretty simple to use it with vim to search Python code.
I just had to do some modifications because I run multiple virtualenvs. I added the following two lines to my
~/.vimrc file after installing ctags:
map <S-F11> :!ctags -R -f $VIRTUAL_ENV/tags $VIRTUAL_ENV/lib/python2.7/site-packages<CT>
Pressing shift-F11 will index all the source in the virtualenv. I can then jump to any class definitions by pressing
ctrl-] while the cursor is over a class. Pressing
ctrl-t brings me back. Works great. One thing I missed is that it doesn't seem to be able to jump to variable definitions, only classes and functions/methods. Looks like I would need something like pycscope for this.