Expose hunks.

Make hunks available to any other plugins which might want to use them.
This commit is contained in:
Andy Stewart
2013-03-01 09:21:02 +01:00
parent 5a48d86dca
commit 1ab2f4dfcc

View File

@@ -313,6 +313,27 @@ function! GitGutterPrevHunk()
endfunction
command GitGutterPrevHunk call GitGutterPrevHunk()
" Returns the git-diff hunks for the current file or an empty list if there
" aren't any hunks.
"
" The return value is a list of lists. There is one inner list per hunk.
"
" [
" [from_line, from_count, to_line, to_count],
" [from_line, from_count, to_line, to_count],
" ...
" ]
"
" where:
"
" `from` - refers to the staged file
" `to` - refers to the working tree's file
" `line` - refers to the line number where the change starts
" `count` - refers to the number of lines the change covers
function! GitGutterGetHunks()
return s:is_active() ? s:hunks : []
endfunction
augroup gitgutter
autocmd!
autocmd BufReadPost,BufWritePost,FileReadPost,FileWritePost * call GitGutter()