Vim-Plug is a powerful vim tool for managing your vim plugins. It has the full-fletch ability to download, install, use, manage, uninstall, and clean-up any external vim plugins. In this section, we get to look on how to install Vim-Plug in our operating system.
To install Vim-Plug manually, you need to download the vim-plug from:
https://github.com/junegunn/vim-plug
OR specifically:
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
into
~/.vim/autoload/plug.vim
Once done, your vim-plug is ready for use. You may follow the instructions from Vim-Plug official site to add plugins and install.
To setup vim-plug automatically, you can attach the following codes into your ~/.bashrc
. As you source your bashrc, it will auto-detect vim-plug existence and install it accordingly. Upon that, it will also automatically install all the vim plugins.
Keep in mind that the automation relies on:
curl
- the web client to download the plug.vim
.!/bin/bash
if [ ! "$(which vim)" = "" ]; then
vimplug_path="${HOME}/.vim/autoload/plug.vim"
url="\
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim"
vimrc_path="${HOME}/.vimrc"
alias vi="vim"
if [ ! -f "$vimplug_path" ]; then
if [ ! "$(which curl)" = "" ]; then
curl -fLo "$vimplug_path" \
--create-dirs \
"$url"
[ -f "$vimrc_path" ] && vim -c PlugInstall -c qall!
[ -f "$vimrc_path" ] && vim -c PlugUpdate -c qall!
else
echo "[ ERROR ] missing curl. Cant't install plug.vim"
fi
fi
unset vimplug_path url vimrc_path
fi
That's all for Vim-Plug automatic setup and and install processes.