[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Seeing Blame/Annotate in the margin in Vim

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Thu, 29 Oct 2009 11:29:58 +0100

This Vim script enables you to show the Blame info in a narrow window at
the side of your source file, as in the screen shot below, with the
scrolling synchronized.

I activate it with the key sequence "gb" (for Go/Get Blame).

Insert the attached script into your ~/.vimrc file.

- Julian


"Show in a new window the Subversion blame annotation for the current file.
" Problem: when there are local mods this doesn't align with the source file.
" To do: When invoked on a revnum in a Blame window, re-blame same file up to previous rev.
:function s:svnBlame()
   let line = line(".")
   setlocal nowrap
   aboveleft 18vnew
   setlocal nomodified readonly buftype=nofile nowrap winwidth=1
   " blame, ignoring white space changes
   %!svn blame -x-w "#"
   " find the highest revision number and highlight it
   "%!sort -n
   "normal G*u
   " return to original line
   exec "normal " . line . "G"
   setlocal scrollbind
   wincmd p
   setlocal scrollbind
:map gb :call <SID>svnBlame()<CR>
:command Blame call s:svnBlame()

Received on 2009-10-29 11:30:36 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.