Permalink
Browse files

Cleaned up the mess with virtualenv-specific ctags.

  • Loading branch information...
1 parent f2779e6 commit f396c91644a45d221a024d8e063f75a0fb01ba6b @zsiciarz committed Aug 22, 2012
Showing with 6 additions and 9 deletions.
  1. +6 −9 vimrc
View
15 vimrc
@@ -81,18 +81,15 @@ let g:Powerline_colorscheme = 'skwp'
" ctags for system Python and for virtual environments
let base_ctags_path = $HOME . "/.vim/tags/python.ctags"
exec 'set tags+=' . base_ctags_path
+" location of site-packages (virtualenv-aware)
+let site_packages = system('python -c "import sys; from distutils.sysconfig import get_python_lib; sys.stdout.write(get_python_lib())"')
if !empty($VIRTUAL_ENV)
- let ctags_path = $VIRTUAL_ENV . "/python.ctags"
- if filereadable(ctags_path)
- exec 'set tags+=' . ctags_path
- endif
-else
- let ctags_path = base_ctags_path
+ " if we are in a virtualenv, create local ctags file and add it to tags
+ let local_ctags_path = $VIRTUAL_ENV . "/python.ctags"
+ exec 'silent !ctags -R -f' local_ctags_path site_packages
+ exec 'set tags+=' . local_ctags_path
endif
-let ctags_src = system('python -c "import sys; from distutils.sysconfig import get_python_lib; sys.stdout.write(get_python_lib())"')
-exec 'map <Leader>t :!ctags -R -f' ctags_path ctags_src . '<CR>'
-
python << EOF
import os
import sys

0 comments on commit f396c91

Please sign in to comment.