diff --git a/vimrc b/vimrc index 0598af1..1c29965 100644 --- a/vimrc +++ b/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 t :!ctags -R -f' ctags_path ctags_src . '' - python << EOF import os import sys