I'm setting up a vim environment install script. I'm using vim-plug for plugin management.
What I'd like to do is, from the install.sh, run vim and call PlugInstall to
trigger plugin download and install.
The plugin file is set up to also set plugin-specific settings, so creates errors
relating to undefined variables when the plugins aren't installed (i.e., the
first time it starts up.) This requires user input of enter to bypass.
Ideally, the process would display the PlugInstall window and require no user
input, without showing plugin error messages.
Second-best would be this, but the
error messages are still seen (still without requiring input).
3rd best would be to have no output, but quietly wait until the plugins are, in
fact, installed.
These are the commands I've tried so far, with their results.
Command runs with no error, but also doesn't actually do anything:
echo "PlugInstall" | vim -es
echo "PlugInstall|qa!" | vim -E
Plugin errors, enter ex then get stuck (treats arg as filename):
vim -ecs PlugInstall\|qa!
vim -ec silent PlugInstall\|qa!
vim -ec silent exec PlugInstall\|qa!
"Error reading input". Still get plugin errors:
echo ":PlugInstall" | vim
Plugin errors requiring enter to continue, then works as desired:
vim -c PlugInstall\|qa!
vim +PlugInstall! +qa!
Edit: Further experimentation managed to get a chimera working. This satisfies second-best outcome. However, it ruins the shell session: input doesn't show up, and the prompt is seriously misaligned.
printf "\n" | vim -c PlugInstall\|qa!
Edit: vim -E +PlugInstall +qall
(mentioned in comments below) satisfies criteria 2