Tips – Using git submodule keep your vim plugin up-to-date
Posted by AllenWei | Posted in Tips, vim | Posted on 08-04-2010-05-2008
View Comments
When we install vim plugin we need copy files to different folders, it’s hard to keep it up-to-date. As lot’s of vim plugin have github repository. we can use git submodule and vim plugin pathogen to keep your plugin up-to-date.
Add bundle support for vim
Fortunately Tim Pope wrote a plugin called pathogen ,which make things easier.
In the home page of the plugin you can find fully install details.
After you add this plugin you can manage your vim plugin in on .vim/bundle folder. You can unzip/untar/svn-checkout/git-clone plugin into this folder. pathogen plugin will load it automatically.
this this what your .vim folder structure look like
|-- bundle
| |-- ack
| | `-- plugin
| | `-- ack.vim
| |-- bufexplorer
| | |-- doc
| | | `-- bufexplorer.txt
| | `-- plugin
| | `-- bufexplorer.vim
| |-- conque
| | |-- autoload
| | | `-- conque_term.vim
| | |-- doc
| | | `-- conque_term.txt
| | |-- plugin
| | | `-- conque_term.vim
| | `-- syntax
| | `-- conque_term.vim
So we have chance to maintain vim plugin as a whole.
How to add a submodule
For example, we add a git plugin fugitive as a submodule of our vim repository.
If you have already added this plugin, make sure remove folder using
Otherwise you will get error 'fugitive' already exists in the index
Then we add vim-fugitive as submodule
After you add submodule you need register it, using
How to update submodule
If this plugin have updates, you can run
to update your submodule repository
The last step push your changes to github, you will see this in your github repository

How to remove a submodule
There is not efficient way to remove a submodule
* first step is remove references to the submodule in .gitmodules and .git/config.
* Then git rm --cached .vim/bundle/fugitive


