ctags with taglist in vim and python virtualenv
ctags, python, taglist, vim, virtualenv
Solution
There are many "automatic tags generation" plugins available.
TagList doesn't read from whatever `tags` you have manually/automatically generated: it's calling `ctags` itself and reads its output directly.
Also you might want to read `:help autocommand`. You could setup autocommands to re-generate your `tags` on write like this:
autocmd BufWritePost,FileWritePost *.py :silent! !ctags -R -o ~/mytags ~/.virtualenvs/myprojectname
Problem
I use `virtualenv` and `django` in my projects and I am trying to find a more efficient way to browse django source code. As advised here - Tools to help developers reading class hierarchy faster - I got myself set-up with ctags via ``` sudo port -v install ctags ``` and installed the vim plugin `taglist` via https://github.com/vim-scripts/taglist.vim Unfortunately, it seems that `ctags` cannot locate my django's class when I attempted to "jump" to view a class via Ctrl+]. Any suggestions how I can get `ctags` to read python source code located in my virtualenv? UPDATES With further experimentation, I realized that `ctags` is some kind of "indexing" program which parses through a given directory/files/file and grabs all the keywords (class names, method names, function names etc) it finds and writes it into a file. This file can be updated and vim plugin `taglist` essentially reads from it to know where to send me to when I do a Ctrlt on a class/method/function name. So I came up with a temporary and manual solution, which I execute in my vim, like this:- ``` :set tags=~/mytags :! ctags -R -o ~/mytags ~/.virtualenvs/myprojectname ``` The first command tells my vim/taglist where my "indexed" results are stored. The second command writes the indexed results into `~/mytags` file by searching recursively (`-R`) down the `~/.virtualenvs/myprojectname` This works but is a very manual way to maintain tags and tags change if I happen to be in a different `virtualenv` environment. Does anyone know of an automated way to manage this `ctags` process?