vim git blame

March 12, 2012

Often when working on a project in git, you may want to be able to quickly see made the code addition that you’re working on.  If you’re in vim this is simple.  Add the command below to your vimrc file:

vmap b :!git blame =expand("%:p")  \| sed -n =line("',=line("'>") p 

Now if you highlight any section of code and  then press Leader+b, git will show you who edited the lines of code.

Discussion, links, and tweets

I'm a developer at thoughtbot.

Follow me on Twitter. I rarely post anything but it can't hurt to try.