kevinhwang91 / rnvimr

Make Ranger running in a floating window to communicate with Neovim via RPC
BSD 3-Clause "New" or "Revised" License
804 stars 17 forks source link

Support the installed `pynvim` and `ranger` in python virtualenv #88

Closed Alienover closed 3 years ago

Alienover commented 3 years ago

Is your feature request related to a problem? Please describe. In setting up NeoVim, I created two python envs for it which are named neovim_py2 and neovim_py3. And of course, the NeoVim required packages (neovim, pynvim) are installed on both envs.

If I install the ranger outside the env, the RPC would timeout in the health checking. ❌ If I install it in the env, it works great. ✅ But I need to activate the env each time I use rnvimr.

Describe the solution you'd like If I need to use rnvimr, I need to activate the env before entering nvim.

Describe alternatives you've considered

Additional context I don't know the detail about rnvimr. But I think nvim should be able to access the packages which are installed in the env if I set g:python_host_prog and python3_host_prog properly.

" Python2 for neovim
if filereadable($HOME.'/.virtualenvs/neovim_py2/bin/python')
    let g:python_host_prog=$HOME.'/.virtualenvs/neovim_py2/bin/python'
endif

" Python3 for neovim
if filereadable($HOME.'/.virtualenvs/neovim_py3/bin/python')
    let g:python3_host_prog=$HOME.'/.virtualenvs/neovim_py3/bin/python'
endif

When I execute the command beblow outside the python env, i returns the site-packages in the env.

:py3 import sys; print(sys.prefix); print(); print(sys.path)

" --> $HOME/.virtualenvs/neovim_py3
" --> ['$HOME/.pyenv/versions/3.7.10/lib/python37.zip', '$HOME/.pyenv/versions/3.7.10/lib/python3.7', '$HOME/.pyenv/versions/3.7.10/lib/python3.7/lib-dynload', '$HOME/.virtualenvs/neovim_py3/lib/python3.7/site-packages', '_vim_path_']

So, I am wondering whether I can install the ranger outside the python env and leave the neovim and pynvim installed in the env.

kevinhwang91 commented 3 years ago

let g:rnvimr_ranger_cmd = 'your venv path/bin/ranger' should work.