Friday, April 26, 2013

Keep your vim plugins up to date

Scenario:
You go and download a plugin from a website but the website says, "Check GitHub for the most uptodate version."
So you get the tarball or the file you need and all is good. If you're okay with this, stop reading. You don't need to know the rest.

Method 1:
cd ~/.vim
mkdir gits
cd gits
git clone https://github.com/user/pluginname.git
ln -s ~/.vim/gits/pluginname/plugin/something.vim ~/.vim/plugin/something.vim
ln -s ~/.vim/gits/pluginname/doc/something.txt ~/.vim/doc/something.txt
ln -s ~/.vim/gits/pluginname/autoload/something.vim ~/.vim/autoload/something.vim
(if it exists -- editorconfig, for example)
Check also for plugin/python folders for your plugins.

Yes, I realize this is a bit more painful than just extract/install, but only slightly.
Now, if you want the latest update from the plugin, you can
cd ~/.vim/gits/pluginname/
git pull

Method 2:

cd ~/.vim
git init
mkdir gits

git submodule add https://github.com/user/pluginname.git gits/pluginname

now do the linking.

This second method allows you to version your changes across the entire .vim folder.

You also can checkout specific branches of the plugin, etc.




No comments:

Blog Archive