How would I execute VimEnter commands with the do ondemand option?
Specifically, I want to execute a VimEnter command after a plugin is Installed and/or Updated. But, not at each startup.
When I have the following:
Plug 'Shougo/deoplete.nvim', { 'do' : ':UpdateRemotePlugins' }
I get this:
Post-update hook for deoplete.nvim ... Exit status: 127
(I have several plugins I'd like to do this for)
I'm sure I'm missing something simple. I looked and didn't see a way to do this.
NVIM 0.1.2
Build type: RelWithDebInfo
Compilation: /usr/local/Library/ENV/4.3/clang -Wconversion -O2 -g -DDISABLE_LOG -Wall -Wextra -pedantic -
Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wvla -fstack-protector-strong -fdiagnostics-color=au
to -DINCLUDE_GENERATED_DECLARATIONS -DHAVE_CONFIG_H -I/tmp/neovim20160220-3119-1882x6q/neovim-0.1.2/build
/config -I/tmp/neovim20160220-3119-1882x6q/neovim-0.1.2/src -I/tmp/neovim20160220-3119-1882x6q/neovim-0.1
.2/deps-build/usr/include -I/tmp/neovim20160220-3119-1882x6q/neovim-0.1.2/deps-build/usr/include -I/tmp/n
eovim20160220-3119-1882x6q/neovim-0.1.2/deps-build/usr/include/luajit-2.0 -I/tmp/neovim20160220-3119-1882
x6q/neovim-0.1.2/deps-build/usr/include -I/tmp/neovim20160220-3119-1882x6q/neovim-0.1.2/deps-build/usr/in
clude -I/tmp/neovim20160220-3119-1882x6q/neovim-0.1.2/deps-build/usr/include -I/tmp/neovim20160220-3119-1
882x6q/neovim-0.1.2/deps-build/usr/include -I/usr/local/opt/gettext/include -I/usr/include -I/usr/include
-I/tmp/neovim20160220-3119-1882x6q/neovim-0.1.2/build/src/nvim/auto -I/tmp/neovim20160220-3119-1882x6q/n
eovim-0.1.2/build/include
The value for do option should be either a string or a reference to a Vim function. And when it's a string, it's interpreted as a shell command. There is an ongoing discussion whether :Something (colon-prefix) should be treated as a Vim command for convenience, but I don't think it's really necessary (Also note that :UpdateRemotePlugins might go away in the future).
See here for the details: https://github.com/junegunn/vim-plug/pull/450#issuecomment-199315671
Thanks for the quick reply!
So, is it possible or not to call UpdateRemotePlugins?
When I try to call the function directly, neovim generates errors:
Plug 'Shougo/deoplete.nvim', { 'do' : UpdateRemotePlugins }
# generates the errors below
#
$ nvim
Error detected while processing /Users/eric/.dotfiles/.vim/init.vim:
line 28:
E121: Undefined variable: UpdateRemotePlugins
E116: Invalid arguments for function <SNR>2_Plug
And...
Plug 'Shougo/deoplete.nvim', { 'do' : UpdateRemotePlugins() }
# generates the errors below
#
$ nvim
Error detected while processing /Users/eric/.dotfiles/.vim/init.vim:
line 28:
E117: Unknown function: UpdateRemotePlugins
E116: Invalid arguments for function <SNR>2_Plug
Those are not valid Vimscript code. UpdateRemotePlugins is an EX command, not a function, so it can't be used as an expression returning a value. For now, just use the funcref as described in the link above.
Ah, thanks! I now see that link. :+1:
Btw, it works if I shell out to run another instance of vim and then quit it.
Plug 'Shougo/deoplete.nvim', { 'do' : 'vim +UpdateRemotePlugins +qall' }
Though, I have to quit and reopen vim/nvim for the plugin to work it seems.
Btw, it works if I shell out to run another instance of vim and then quit it.
That's clever :)
Though, I have to quit and reopen vim/nvim for the plugin to work it seems.
Yeah, unfortunately a restart is required as of now.
See the discussion here: https://github.com/junegunn/vim-plug/issues/125#issuecomment-160184186
Most helpful comment
Ah, thanks! I now see that link. :+1:
Btw, it works if I shell out to run another instance of vim and then quit it.
Though, I have to quit and reopen vim/nvim for the plugin to work it seems.