Not really, it boils down to being able to index all those source codes in your virtualenv site-packages and src
So first you’ll need to install exuberant-ctags, come back when you are done.
First thing first, I get ctags to refresh(or re-tag, whatever) the tags file every time I activate my virtualenv, in order to achieve this I have this snippet in ~/.virtualenvs/postactivate
#!/bin/bash
# This hook is run after every virtualenv is activated.
proj_name=$(echo $VIRTUAL_ENV|awk -F'/' '{print $NF}')
cd () {
if (( $# == 0 ))
then
builtin cd $HOME/projects/$proj_name
else
builtin cd "$@"
fi
}
cd
ctags -f $VIRTUAL_ENV/tags -R $VIRTUAL_ENV/lib/python2.7/site-packages $VIRTUAL_ENV/src ${PWD} &> /dev/null & disown
Word of caution, it changes your cd behaviour and will take you to your project directory right after you activate (don’t worry there’s a corresponding postdeactivate script to get everything back to normal), and yes if you use virtualenvwrapper (why wouldn’t you???), you could workon <project_name> any where and end up in your project directory.
You might be wondering why do I want to land in my project directory post-activation (other than the obvious reason that it is convenient), look at the last line in the snippet above, -R indicates the directory you want ctags to look when it is compiling those pesky tags, and the last of it is ${PWD} which stands for present working directory (we want ctags to grab those definition in our app too right?). Feel free to use other method, whatever suits your mood really.
In case you’re still nervous about the change in cd behaviour, here’s the ~/.virtualenvs/postdeactivate
#!/bin/bash
# This hook is run after every virtualenv is deactivated.
cd () {
if (( $# == 0 ))
then
builtin cd ~
else
builtin cd "$@"
fi
}
cd
also put this in ~/.ctags (create the file if you don’t already have it)
--python-kinds=-i
#this is to tell ctags not to mark import as tag
Hokay last step, put this in ~/.vimrc
set tags=$VIRTUAL_ENV/tags,~/tags;/
map <F5> :rightbelow vsp <CR>:exec("tag ".expand("<cword>"))<CR>
#in addition to ctrl+] , i could press F5 to open up a vertical split in vim and
#view the source code
Done! Go forth and discover source code in obscure location no sane man has seen before (do let me know if I missed anything/have something I can add to make this post better)