Improve output of GitCompare

This commit is contained in:
Talia 2018-04-12 10:02:43 +02:00
parent 9108000b77
commit 7aa2ac0433

17
vimrc
View file

@ -338,7 +338,7 @@ endfun
function! s:git_info() function! s:git_info()
if !exists("b:git_revision_hash") || !exists("b:git_original_file") if !exists("b:git_revision_hash") || !exists("b:git_original_file")
echo "Error 01: Not a file@revision buffer!" echo "Not a file@revision buffer!"
return return
end end
echo system("git show --no-patch ".b:git_revision_hash) echo system("git show --no-patch ".b:git_revision_hash)
@ -409,16 +409,17 @@ function! s:file_at_revision(rev)
let b:git_original_file = l:fname let b:git_original_file = l:fname
let b:git_revision_hash = a:rev let b:git_revision_hash = a:rev
call s:git_info()
endfun endfun
function! s:git_diff(...) function! s:git_diff(...)
if a:0 if a:0
diffthis
split split
call s:file_at_revision(a:1) call s:file_at_revision(a:1)
au BufUnload <buffer> diffoff!
diffthis diffthis
au BufUnload <buffer> diffoff!
exec "normal \<C-w>\<C-p>"
diffthis
call s:git_info()
else else
if exists("b:git_revision_hash") if exists("b:git_revision_hash")
call s:git_diff(get(s:git_history(), index(s:git_history(), b:git_revision_hash)+1, "NIL")) call s:git_diff(get(s:git_history(), index(s:git_history(), b:git_revision_hash)+1, "NIL"))
@ -428,10 +429,10 @@ function! s:git_diff(...)
end end
endfun endfun
command! GitNext call <sid>git_next() command! GitNext call <sid>git_next() | call s:git_info()
command! GitPrev call <sid>git_prev() command! GitPrev call <sid>git_prev() | call s:git_info()
command! GitFirst call <sid>git_first() command! GitFirst call <sid>git_first() | call s:git_info()
command! GitLast call <sid>git_last() command! GitLast call <sid>git_last() | call s:git_info()
command! GitInfo call <sid>git_info() command! GitInfo call <sid>git_info()
command! -nargs=1 GitCheckout call <sid>file_at_revision(<f-args>) command! -nargs=1 GitCheckout call <sid>file_at_revision(<f-args>)
command! -nargs=? GitCompare call <sid>git_diff(<f-args>) command! -nargs=? GitCompare call <sid>git_diff(<f-args>)