Skip to content

Instantly share code, notes, and snippets.

@stantonk
Created August 5, 2014 02:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stantonk/9f4f103e473fa00567c4 to your computer and use it in GitHub Desktop.
Save stantonk/9f4f103e473fa00567c4 to your computer and use it in GitHub Desktop.
View git blame, hg blame, svn blame in vim or MacVim. Note, you must first select the source lines with visual mode, then hit the appropriate leader key sequence. Enjoy!
" version control blame of selected lines
"vmap <Leader>b :<C-U>!svn blame <C-R>=expand("%:p") <CR> \| sed -n <C-R>=line("'<") <CR>,<C-R>=line("'>") <CR>p <CR>
vmap <Leader>g :<C-U>!git blame <C-R>=expand("%:p") <CR> \| sed -n <C-R>=line("'<") <CR>,<C-R>=line("'>") <CR>p <CR>
vmap <Leader>h :<C-U>!hg blame -fu <C-R>=expand("%:p") <CR> \| sed -n <C-R>=line("'<") <CR>,<C-R>=line("'>") <CR>p <CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment