Skip to content

Commit

Permalink
Cleaned up the mess with virtualenv-specific ctags.
Browse files Browse the repository at this point in the history
  • Loading branch information
zsiciarz committed Aug 22, 2012
1 parent f2779e6 commit f396c91
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions vimrc
Expand Up @@ -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
Expand Down

0 comments on commit f396c91

Please sign in to comment.