junegunn / vim-plug

:hibiscus: Minimalist Vim Plugin Manager
https://junegunn.github.io/vim-plug/
MIT License
33.7k stars 1.9k forks source link

Support python requirements in remote plugins #1240

Closed eyalk11 closed 1 year ago

eyalk11 commented 1 year ago

I tried to install my plugin , and it doesn't seem to support python requirements (download the required etc).

This is the repo.

call plug#begin('C:\\Users\\User\\vimfiles\\plugged')
Plug 'eyalk11/nvim-voicerec'
call plug#end()

https://github.com/eyalk11/nvim-voicerec

Shougo commented 1 year ago

You can use this. https://github.com/junegunn/vim-plug/blob/master/doc/plug.txt#L291-L291

eyalk11 commented 1 year ago

It is true. But I think this is a functionality the plugin manager should ideally have.

PS I tried

Plug 'eyalk11/nvim-voicerec', {'do': ':!python -m pip install -r ./requirements.txt \| :UpdateRemotePlugins'}

Didn't work. I couldn't understand if it runs the python or not / what is the output.

junegunn commented 1 year ago

It would be easier to see what's going on under the hood if you use a function like so (maybe with some logging).

" You don't have to write the full path as the working directory is automatically set to the plugin directory
function! VoicerecDependencies()
  !pip install -r requirements.txt
  UpdateRemotePlugins
endfunction

Plug 'eyalk11/nvim-voicerec', { 'do': { -> VoicerecDependencies() } }
junegunn commented 1 year ago

Also, instead of having users define the function, your plugin can provide it as an autoload function, so the users can just write:

Plug 'eyalk11/nvim-voicerec', { 'do': { -> voicerec#install() } }