mirror of
https://github.com/junegunn/vim-plug.git
synced 2024-12-19 18:47:29 -07:00
Simplify the example code
parent
1cd87f4509
commit
0f9aac4253
15
tips.md
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.
|
||||
|
||||
```vim
|
||||
" Put this code before Plug block (plug#begin ~ plug#end)
|
||||
|
||||
" 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
|
||||
|
||||
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
|
||||
if exists('g:plugs') && len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
|
||||
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
|
||||
endif
|
||||
autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
|
||||
\| PlugInstall --sync | source $MYVIMRC
|
||||
\| endif
|
||||
```
|
||||
|
||||
Note that this may increase the startup time of Vim.
|
||||
|
Loading…
Reference in New Issue
Block a user