Simplify the example code

Junegunn Choi 2020-12-02 09:48:09 +09:00
parent 1cd87f4509
commit 0f9aac4253

15
tips.md

@ -25,23 +25,18 @@ Resort to this only if git cannot get updated certificates or if Github has TLS/
You can even go a step further and make `:PlugInstall` run on startup if there are any missing plugins. You can even go a step further and make `:PlugInstall` run on startup if there are any missing plugins.
```vim ```vim
" Put this code before Plug block (plug#begin ~ plug#end)
" Install vim-plug if not found " Install vim-plug if not found
if empty(glob('~/.vim/autoload/plug.vim')) if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
endif endif
call plug#begin()
if exists('g:loaded_plug')
" Uncommment the following line to install documentation
" Plug 'junegunn/vim-plug'
call plug#end()
endif
" Run PlugInstall if there are missing plugins " Run PlugInstall if there are missing plugins
if exists('g:plugs') && len(filter(values(g:plugs), '!isdirectory(v:val.dir)')) autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC \| PlugInstall --sync | source $MYVIMRC
endif \| endif
``` ```
Note that this may increase the startup time of Vim. Note that this may increase the startup time of Vim.