Vim-plug: Run PlugInstall non-interactively from command line

Created on 7 Sep 2017  路  5Comments  路  Source: junegunn/vim-plug

I'd like to run PlugInstall non-interactively from the command line to provision a new system (using Ansible in this case). If I do vim -c 'PlugInstall' it works, but it is interactive, opening up a terminal window where you can see the progress of the installation. If I try to run it non-interactively I get an error, e.g. "Vim: Warning: Output is not to a terminal", "Vim: Warning: Input is not from a terminal".

NeoBundle provides a script to install ~/.vim/bundle/neobundle.vim/bin/neoinstall non-interactively, could vim-plug offer something similar?

question

Most helpful comment

Vim: Warning: Output is not to a terminal

It's a warning not an error. As far as I know, vim will proceed to install the plugins even in that case. Since the installer on Vim 8 is asynchronous, you might want to pass --sync flag as follows

vim +'PlugInstall --sync' +qa

Let me know if it doesn't work as expected.

All 5 comments

Vim: Warning: Output is not to a terminal

It's a warning not an error. As far as I know, vim will proceed to install the plugins even in that case. Since the installer on Vim 8 is asynchronous, you might want to pass --sync flag as follows

vim +'PlugInstall --sync' +qa

Let me know if it doesn't work as expected.

That worked, thank you!

What does the +qa do btw?

And the + near the beginning? I noticed you used that instead of -c.

  • :help :qa (quit all)
  • + is just a shorthand notation of -c, see man vim.

Thanks! - I wish I would have looked this up sooner. It's great to be able interact with vim in a shell script.

Thanks to this:
https://github.com/junegunn/vim-plug/issues/225#issuecomment-583541912
This is the only thing working for nvim:

nvim --headless +PlugInstall +qall
Was this page helpful?
5 / 5 - 1 ratings

Related issues

LandonSchropp picture LandonSchropp  路  4Comments

bmcilw1 picture bmcilw1  路  3Comments

phongvcao picture phongvcao  路  4Comments

Mryehua picture Mryehua  路  4Comments

RubenVerborgh picture RubenVerborgh  路  3Comments