Switching From Pathogen to Vundle with Vim

Nov 12, 2013 00:00 · 650 words · 4 minute read vim

If you use Pathogen you are probably aware of the many fun issues that come along with managing git submodules. It’s actually discouraged to use submodules in the first place and using Pathogen has shown me exactly why not to. First when you call in the main repo your submodules don’t come along you have to run two extra commands to bring them in.

git clone https://github.com/thornycrackers/.vim
git submodule init
git submodules update

That’s alright, but we could be more efficient. Now you got your addons and one gets updated so you have to pull the submodule. Have you ever tried googling the command for this? The fact that I can never find a straight answer for this worries me, it’s always changing. Why? I don’t know but I get the feeling that something isn’t right here. What about if you want to remove one of the submodules? Heres a quote from StackOverflow:

  1. Delete the relevant section from the .gitmodules file.
  2. Stage the .gitmodules changes git add .gitmodules
  3. Delete the relevant section from .git/config.
  4. Run git rm –cached path_to_submodule (no trailing slash).
  5. Run rm -rf .git/modules/path_to_submodule
  6. Commit git commit -m “Removed submodule “
  7. Delete the now untracked submodule files
  8. rm -rf path_to_submodule


I thought I was removing a submodule not summoning Cthulhu. Needless to say this is not how complicated it should be to manage plugins. Here comes Vundle. Vundle is so much easier, so easy in fact that I was confused at first when I read it saying “That’s all I do?”. The way I set up my Vundle is I first cloned the newest repo into .vim/bundle/vundle and then removed the .git folder in Vundle. This means manual updates for Vundle but I’m alright with that because I don’t feel like I’ll need to do that very often. The second step is add the following into your vimrc file:

set nocompatible               " be iMproved
filetype off                   " required!

set rtp+=~/.vim/bundle/vundle/
call vundle#rc()

" Bundles
Bundle 'nathanaelkane/vim-indent-guides'
Bundle 'scrooloose/nerdtree'
Bundle 'Lokaltog/powerline'
Bundle 'tpope/vim-surround'
Bundle 'mattn/emmet-vim'
Bundle 'Lokaltog/vim-easymotion'
Bundle 'tmhedberg/matchit'
Bundle 'scrooloose/syntastic'
Bundle 'Raimondi/delimitMate'

filetype plugin indent on     " required!

You can replace the bundles you want with your preference these are just mine. Now that you have the Vundle plugin installed and the configs set all you do to install addons is run “vim +BundleInstall +qall” or open Vim and run :BundleInstall. WOW. Yes it is really that easy. This command also updates the Bundles, at least in the current version according to the github page.

Symbolic Links

Now to make this process even more fluid I like to put my .vimrc file inside my .vim repository and symbolically link it so that when I run a git pull it automatically updates my files in one command. A symbolic link is like a pointer to another file. To create one use the following command:

ln -s ~/.vim/.vimrc ~/.vimrc

Now any changes to ~/.vimrc will be reflected in ~/.vim/.vimrc and vice versa. With Vundle my installation of my vim settings and addons is now 3 commands:

git clone https://github.com/thornycrackers/.vim
ln -s ~/.vim/.vimrc ~/.vimrc
vim +BundleInstall +qall

Symbolic Links: One Step Further

Now I use my .vim repo and a linux toolkit. I keep examples of other code in it for reference as well as more than just my .vimrc config. I have my .gitconfig and my .tmux.conf as well. So instead of linking all 3 files seperatly I made a script that simply runs the commands in my repo and I run that.

ln -s ~/.vim/.tmux.conf ~/.tmux.conf
ln -s ~/.vim/.gitconfig ~/.gitconfig
ln -s ~/.vim/.vimrc ~/.vimrc

This means that importing my entire Vim setup is as easy as:

git clone https://github.com/thornycrackers/.vim
sh .vim/symbolic-link-script
vim +BundleInstall +qall

3 commands to get completely set up in a new environment? I’ll take it. I could probably nitpick and try to make it into 1 script but I’m ok with just 3 commands.