per the recommendation in the vim-plug
wiki: https://github.com/junegunn/vim-plug/wiki/extra, I've added the following snippet to my vimrc:
" Install missing plugins on Vim startup
autocmd VimEnter *
\ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
\| PlugInstall --sync | q
\| endif
This does indeed cause any missing plugins to be installed on Vim startup, but on subsequent launches on Ubuntu (18.04 LTS, with apt's version of vim and a version I built from source) the body of the if statement continues to evaluate to 1 (verified with echomsg
), so the plugin installation screen flashes every time I open vim.
This is not the case on macOS; once the plugins are installed for the first time, the body of the if statement no longer evaluates to 1, and the PlugInstall
screen no longer displays.
How would I go about fixing this?
filter(...)
, it's not empty.filter
command so that we can have an idea of what is happening. Also if I may add my two cents: Is it really worth it to add to your vimrc an autocommand which will be executed every time you start vim and which is already causing some issues just to runPlugInstall
once which you could do manually or from the script which installs your dotfiles to a new machine? And finally your autocommands should always be in a:h :augroup
.filter
helped diagnose the problem, my vimrc also contained the following line:" If installed using Homebrew Plug '/usr/local/opt/fzf'
which referred to a program that wasn‘t installed but also couldn‘t be installed byvim-plug
. Installing it properly fixed the problem. statox, I will consider your comments about including this section at all, it might not be worth the trouble. Thank you both!