How to install a vim plugin
- Install vim-plug.
- Download plug.vim or execute
wget https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
. Orcurl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
- Put plug.vim in the autoload directory. If the folder doesn't exist, create one with
mkdir ~/.vim/autoload
. - Add vim-plug tags in vimrc file and put you'd like to install plugin between these tags. For instance, I want to install nerdtree plugin. The vimrc looks like this.
call plug#begin('~/.vim/plugged') Plug 'preservim/nerdtree' call plug#end()
- Next, restart vim or execute command
so %
in the command mode to reload the setting file vimrc. - Run command
PlugInstall
to install plugins. - :
q
to leave plugin install window
Remember
If you don't want to install any plugin and commet it in the plug block, it will not take effect. You need to remove this line or move this line outside the plug block.