From ea2ad17b0692774d82b363a8c5ae69dfd8e2b506 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Mon, 28 Sep 2020 16:19:13 +0900 Subject: [PATCH] Updated tips (markdown) --- tips.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tips.md b/tips.md index e4922d7..a9a3fd6 100644 --- a/tips.md +++ b/tips.md @@ -20,6 +20,25 @@ If you're behind an HTTP proxy and your proxy does not have TLS/SSL certificates Resort to this only if git cannot get updated certificates or if Github has TLS/SSL issues. +#### Automatic installation of missing plugins + +You can even go a step further and make `:PlugInstall` run on startup if there are any missing plugins. + +```vim +" Install vim-plug if not found +if empty(glob('~/.vim/autoload/plug.vim')) + silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs + \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim +endif + +" Run PlugInstall if there are missing plugins +if len(filter(values(g:plugs), '!isdirectory(v:val.dir)')) + autocmd VimEnter * PlugInstall --sync | source $MYVIMRC +endif +``` + +Note that this may increase the startup time of Vim. + ### Install plugins on the command line ```sh