Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run PlugInstall non-interactively from command line #675

Closed
rightaway opened this issue Sep 7, 2017 · 7 comments
Closed

Run PlugInstall non-interactively from command line #675

rightaway opened this issue Sep 7, 2017 · 7 comments
Labels

Comments

@rightaway
Copy link

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?

@junegunn
Copy link
Owner

junegunn commented Sep 8, 2017

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.

@rightaway
Copy link
Author

That worked, thank you!

What does the +qa do btw?

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

@junegunn
Copy link
Owner

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

@dgdosen
Copy link

dgdosen commented Oct 17, 2019

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

@mosheavni
Copy link

Thanks to this:
#225 (comment)
This is the only thing working for nvim:

nvim --headless +PlugInstall +qall

@heinosasshallik
Copy link

Note that you need a newer NeoVim version for this. NeoVim 0.2.2 (which is the current version you might get using apt install on older distros) won't work.

What worked for me was the Automatic Installation section of this github wiki page:
https://github-wiki-see.page/m/junegunn/vim-plug/wiki/tips

Place the following code in your .vimrc before plug#begin() call

let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
if empty(glob(data_dir . '/autoload/plug.vim'))
  silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs  https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
  autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif

Make sure you change the $MYVIMRC variable and that your data directory is correct.

@FlorianWanders
Copy link

FlorianWanders commented Mar 15, 2022

If you are using deoplete on nvim, adding this line worked for me:

nvim --headless +PlugInstall +qa
nvim +UpdateRemotePlugins +qa

First line installs plugins (see comments above), 2nd line updates remote plugins (required for deoplete).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants