IntroductionThere's no denying that Vim is awesome on its own. It provides users with unprecedented configuration potential and quick, powerful commands. That said, Vim can get even better with the use of plugins.
There are hundreds of plugins that can seriously amp-up your Vim installation. Many of them are tailored for specific uses, like programming in a certain language or even writing. Others are more general and enhance Vim's existing capabilities. Whichever it is that you need, you're going to have to manage those packages.
There are a number of Vim package managers, but Pathogen is the most universal and simple to use and install. Pathogen works by pulling all of the Vim plugins in a certain directory into your Vim installation and activating them with a single line in your
Required PackagesBefore you get started, you should probably make sure that you have both Vim and Git installed on your system. These are both very common packages, so there's not too much need to go into detail here, just install them, if you haven't already.
# apt-get install vim git
# dnf/yum -y install vim git
# pacman -S vim git
Setting Up The DirectoriesAll of this is done locally, on a per-user basis. It requires a
.vimfolder in your
/homedirectory. If you don't already have it, create it.
$ mkdir ~/.vimInside that folder, you must create two more.
cdin and make
$ cd ~/.vim $ mkdir autoload $ mkdir bundle
Installing PathogenPathogen is best installed via Git. It's actually a Vim plugin itself, so it's a Vim script that needs to be cloned from its Git repository. Since you want Pathogen to run automatically, it needs to be installed into the
autoloaddirectory that you just created.
$ cd autoload git clone https://github.com/tpope/vim-pathogen.gitWhen that clone finishes, you will have Pathogen installed.
Configuring .vimrcYou do have to add one line to your
.vimrcfile to use Pathogen. If you somehow don't already have the file, you can create it at the same time you add Pathogen. The file exists at the root of your
vim ~/.vimrcIf you did just create the file for the first time, and you don't have anything else, add these few lines.
set nocompatible filetype plugin indent on syntax on execute pathogen#infect()If you have an existing
.vimrcthat you built up, the following line to the file.
execute pathogen#infect()Either way, you should make sure that you have at least the lines above in your configuration. All you need to do for the changes to take effect is close out of Vim and open it again.
Installing and Managing PluginsThe whole reason you installed Pathogen was to get those great plugins to boost Vim's capabilities. Now, you're finally ready to pick a few and install them.
Vim-airline is a very popular status line plugin for monitoring what's going on in Vim while you're using it. This guide will go over installing it. If you really don't want airline, just pick another plugin. The procedure is the same.
InstallingBefore installing any plugin on Vim, you have to find it first. Most of them are available through Github, and you can just do a quick search for them. To save time, you can get airline here.
Click on the "Clone or Download" button and copy the Git address. If you want to know more about vim-airline, that Github page is an excellent resource.
With the git link copied,
bundledirectory that you created and clone the Git repository.
$ cd ~/.vim/bundle $ git clone https://github.com/vim-airline/vim-airlinePathogen will pull in vim-airline every time it starts. To see the airline bar when you start up vim, add the lines belo to your
set laststatus=2There's a ton more that you can do with vim-airline, but that's outside the scope of this guide. Refer to the Github page for more, or just experiment.
UpdatesUpdates can be accomplished by performing a pull with Git inside the plugin directory. For example, to update vim-airline, you would
$ cd ~/.vim/bundle/vim-airline $ git pull origin masterThe same will be true of very plugin that you cloned with Git. You can easily write up a shell script to iterate through each directory and pull and even set it to a cron job to fully automate the update process, if you want to.
Keep in mind that you can keep Pathogen itself up-to-date the same way because you cloned it from Github too.