DEV Community

Shubhashish Dixit
Shubhashish Dixit

Posted on

How to run autocomplete(JEDI) inside virtualenv in vim

So, I basically switched to neovim and realized that autocomplete does not work when you're inside the virtualenv using the the vim editor
and as cumbersome as it is to find a solution online. I stumbled upon a workaround.

# Make sure you have all the plugins installed
# open your ~/.config/.vimrc or ~/.config/nvim/init.vim with vim and type

:CocConfig

# you may see something like 
{
     "suggest.timeout": 5000,
     "python.pythonPath": "python"
# OR "python.pythonPath": "/usr/bin/python"
}

# the easiest workaround is to change "python.pythonPath": "python"
to "python.pythonPath": "python3"

{
    "suggest.timeout": 5000,
    "python.pythonPath": "python3"
}

# save this file and exit
# activate your virtualenv and check for yourself which python3 is your 
# vim currently using `:!which python3`

# This should definitely work till a permanent solution comes around.

Top comments (2)

Collapse
 
bezirganyan profile image
Grigor Bezirganyan

Can you please state you reason for changing to neovim? What were the gains of it, and what practical advantages does it give against vim 8?

Collapse
 
thisisshub profile image
Shubhashish Dixit

well it was more of a personal preference that I got when I changed to nvim. First of all my Load Average of pc went way down, which meant quicker file opening hence easier edits. To me vim was kinda overwhelming at first hence I stuck with nvim, although I'd transfer to vim along this month but nvim is still great : )