How to make vimrc work when there is no plug

Use case: user configured `.vimrc`, copied it to another machine, but did not install `plug` there. `.vimrc` will fail with many errors.

Update `README.md` with instructions how to deal with this case.
This commit is contained in:
Stepan Koltsov 2021-01-25 23:43:04 +00:00 committed by GitHub
parent 8b45742540
commit 0c1e32ea39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -99,40 +99,42 @@ Add a vim-plug section to your `~/.vimrc` (or `stdpath('config') . '/init.vim'`
" Specify a directory for plugins " Specify a directory for plugins
" - For Neovim: stdpath('data') . '/plugged' " - For Neovim: stdpath('data') . '/plugged'
" - Avoid using standard Vim directory names like 'plugin' " - Avoid using standard Vim directory names like 'plugin'
call plug#begin('~/.vim/plugged') silent! call plug#begin('~/.vim/plugged')
if exists('g:plug_home') " Only invoke following commands if `plug` is installed
" Make sure you use single quotes " Make sure you use single quotes
" Shorthand notation; fetches https://github.com/junegunn/vim-easy-align " Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
Plug 'junegunn/vim-easy-align' Plug 'junegunn/vim-easy-align'
" Any valid git URL is allowed " Any valid git URL is allowed
Plug 'https://github.com/junegunn/vim-github-dashboard.git' Plug 'https://github.com/junegunn/vim-github-dashboard.git'
" Multiple Plug commands can be written in a single line using | separators " Multiple Plug commands can be written in a single line using | separators
Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets' Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
" On-demand loading " On-demand loading
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'tpope/vim-fireplace', { 'for': 'clojure' } Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
" Using a non-default branch " Using a non-default branch
Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' } Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
" Using a tagged release; wildcard allowed (requires git 1.9.2 or above) " Using a tagged release; wildcard allowed (requires git 1.9.2 or above)
Plug 'fatih/vim-go', { 'tag': '*' } Plug 'fatih/vim-go', { 'tag': '*' }
" Plugin options " Plugin options
Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' } Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' }
" Plugin outside ~/.vim/plugged with post-update hook " Plugin outside ~/.vim/plugged with post-update hook
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
" Unmanaged plugin (manually installed and updated) " Unmanaged plugin (manually installed and updated)
Plug '~/my-prototype-plugin' Plug '~/my-prototype-plugin'
" Initialize plugin system " Initialize plugin system
call plug#end() call plug#end()
endif
``` ```
Reload .vimrc and `:PlugInstall` to install plugins. Reload .vimrc and `:PlugInstall` to install plugins.