summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugues Hiegel <hugues@hiegel.fr>2009-11-26 22:14:28 +0100
committerHugues Hiegel <hugues@hiegel.fr>2009-11-26 22:14:28 +0100
commit09f138e4a5f11d7b843a66adba5977cd7ad88956 (patch)
treea3ebb39040224287eb9759d3ca264d256c25b069
parent4a1a012b244b088d4ec0c764a28eb9edd8830a99 (diff)
[Vim] thanks greg_th for this git-blame current line stuff
-rw-r--r--vimrc11
1 files changed, 11 insertions, 0 deletions
diff --git a/vimrc b/vimrc
index 4d7e781..e60c103 100644
--- a/vimrc
+++ b/vimrc
@@ -164,6 +164,17 @@ function! Erase_Sig_but_Your()
endif
endfunction
+function! GitBlameCurrentLine()
+ let l:line = line('.')
+ let l:file = expand("%:t")
+ let l:wd = expand("%:p:h")
+ let content = system("cd " . l:wd . ";git blame -L ". l:line . "," . l:line . " " . l:file . " | sed 's/).*/)/'")
+ let line = split(content, '\n')[0]
+ echohl Type | echo line | echohl None
+endfunction
+command! GitBlameCurrentLine :call GitBlameCurrentLine()
+map <ESC>b :GitBlameCurrentLine<CR>
+
" <ESC>n goto next empty reply-to paragraph
" <ESC>m opens an empty reply-paragraph at this line
" <ESC>d deletes everything until but the signature