Nowadays, people share even their DNA on GitHub. With such a healthy open-source ecosystem and new updates every day, here is a way to keep up with the latest versions of your vim plug-ins.
Let’s start with an idea - consider your vim configuration as project, with plug-ins as dependencies. Since you want to have the latest and greatest, you may want to directly link to their sources on github. But how? This is where git submodules come in:
<code title="git submodule basic syntax">git submodule add <repository> [<path>] </code>
In the case of your vim configuration, the above command will take the following form:
<code title="cloning the NerdTree plug-in to your vim bundle">git submodule add https://github.com/scrooloose/nerdtree.git .vim/bundle/nerdtree</code>
The above command will add a reference to the project located at
This great plug-in will load other plug-ins from the ~/.vim/bundle directory. Since pathogen is yet another dependency of the project, it should be placed in the .vim/bundle folder:
<code title="cloning the NerdTree plug-in to your git bundle">git submodule add https://github.com/tpope/vim-pathogen.git .vim/bundle/pathogen</code> <code title="pathogen initialization">source ~/.vim/bundle/pathogen/autoload/pathogen.vim call pathogen#infect()</code>
Now that vim is infected with the pathogen, your modules are fully loaded. Hack away!
Here comes the really sweet part: if you want to update all your plug-ins (bound by submodules), it is as sexy as running one line in bash:
<code title="updating all git submodules (i.e. vim plug-ins)">git submodule foreach git pull origin master </code>
Updating a single module is done by a
git pull origin master, if you ever need to.
I hope that this will let you manage your vim configuration with ease - it works great for me! We are one step closer to our personal configuration heaven. If you found this article to be useful, leave a comment or hit me up on twitter!