| "Show the Subversion 'blame' annotation for the current file, in a narrow |
| " window to the left of it. |
| "Usage: |
| " 'gb' or ':Blame' |
| " To get rid of it, close or delete the annotation buffer. |
| "Bugs: |
| " If the source file buffer has unsaved changes, these aren't noticed and |
| " the annotations won't align properly. Should either warn or preferably |
| " annotate the actual buffer contents rather than the last saved version. |
| " When annotating the same source file again, it creates a new annotation |
| " buffer. It should re-use the existing one if it still exists. |
| "Possible enhancements: |
| " When invoked on a revnum in a Blame window, re-blame same file up to the |
| " previous revision. |
| " Dynamically synchronize when edits are made to the source file. |
| :function s:svnBlame() |
| let line = line(".") |
| setlocal nowrap |
| " create a new window at the left-hand side |
| aboveleft 18vnew |
| " blame, ignoring white space changes |
| %!svn blame -x-w "#" |
| setlocal nomodified readonly buftype=nofile nowrap winwidth=1 |
| setlocal nonumber |
| if has('&relativenumber') | setlocal norelativenumber | endif |
| " return to original line |
| exec "normal " . line . "G" |
| " synchronize scrolling, and return to original window |
| setlocal scrollbind |
| wincmd p |
| setlocal scrollbind |
| syncbind |
| :endfunction |
| :map gb :call <SID>svnBlame()<CR> |
| :command Blame call s:svnBlame() |
| |