VIM: YCM and Pipenv

While writing another python script under pipenv I have met a problem that YCM autocomplete worked only for built in functions. That was annoying because without autocomplete YCM looses it’s sense. Solution Let’s create module for filetype plugin. cat ~/.vim/after/ftplugin/python.vim if !empty($VIRTUAL_ENV) let g:ycm_server_python_interpreter = $VIRTUAL_ENV . '/bin/python' let $PYTHONPATH = finddir('site-packages', $VIRTUAL_ENV . '/lib/*') endif Then you can simply run command pipenv run vim some/script.py And now YCM works correctly :3

October 14, 2020