Friday, April 26, 2013

Keep your vim plugins up to date

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
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 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.

Saturday, April 20, 2013

Git make "clean" pull request.

Scenario: You've worked your tail off and *know* you're done with .. whatever you're working on, and can't be bothered to fixup/squash/commits properly to hide your work method to send upstream.

you have the most recent git fetch from upstream and you're ready to do a pull request.

git checkout upstream/master
(you get a warning that you're in headless mode. In this case, great, let's do what it says:)

git checkout -b mybranchforthispullrequest

Now you're basically looking at plain upstream/master.

you can either
git merge mylocalworkingbranch (but this keeps the commit history)

or, if you're *certain* you only want to add/replace files (hopefully, only add)
git checkout mylocalworkingbranch myfileiwanttoadd.ext

git add myfileiwanttoadd.ext

git commit -m "Added myfileiwanttoadd.ext"

and just send the branch to your origin or upstream
git push origin mybranchforthispullrequest

Optionally, go to github and do a pull request from mybranchforthispullrequest.

Blog Archive