Make GitCompare the one ring to compare them all
This commit is contained in:
parent
6d8b1a41d2
commit
9108000b77
1 changed files with 24 additions and 19 deletions
25
vimrc
25
vimrc
|
@ -366,16 +366,16 @@ endfun
|
||||||
|
|
||||||
function! s:git_prev()
|
function! s:git_prev()
|
||||||
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!"
|
let l:new_revision = s:git_history()[0]
|
||||||
return
|
else
|
||||||
end
|
|
||||||
let l:history = s:git_history()
|
let l:history = s:git_history()
|
||||||
let l:idx = index(l:history, b:git_revision_hash)
|
let l:idx = index(l:history, b:git_revision_hash)
|
||||||
if l:idx == -1
|
if l:idx == -1
|
||||||
echo "Error 02"
|
echo "Error 03: cannot find revision ".b:git_revision_hash
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
let l:new_revision = get(l:history, l:idx+1, "FIRST")
|
let l:new_revision = get(l:history, l:idx+1, "FIRST")
|
||||||
|
end
|
||||||
if l:new_revision=="FIRST"
|
if l:new_revision=="FIRST"
|
||||||
echo "Already at earliest revision! ".l:new_revision
|
echo "Already at earliest revision! ".l:new_revision
|
||||||
return
|
return
|
||||||
|
@ -412,12 +412,20 @@ function! s:file_at_revision(rev)
|
||||||
call s:git_info()
|
call s:git_info()
|
||||||
endfun
|
endfun
|
||||||
|
|
||||||
function! s:git_diff(revision)
|
function! s:git_diff(...)
|
||||||
|
if a:0
|
||||||
diffthis
|
diffthis
|
||||||
split
|
split
|
||||||
call s:file_at_revision(a:revision)
|
call s:file_at_revision(a:1)
|
||||||
au BufUnload <buffer> diffoff!
|
au BufUnload <buffer> diffoff!
|
||||||
diffthis
|
diffthis
|
||||||
|
else
|
||||||
|
if exists("b:git_revision_hash")
|
||||||
|
call s:git_diff(get(s:git_history(), index(s:git_history(), b:git_revision_hash)+1, "NIL"))
|
||||||
|
else
|
||||||
|
call s:git_diff("HEAD")
|
||||||
|
end
|
||||||
|
end
|
||||||
endfun
|
endfun
|
||||||
|
|
||||||
command! GitNext call <sid>git_next()
|
command! GitNext call <sid>git_next()
|
||||||
|
@ -426,10 +434,7 @@ command! GitFirst call <sid>git_first()
|
||||||
command! GitLast call <sid>git_last()
|
command! GitLast call <sid>git_last()
|
||||||
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=1 GitCompare call <sid>uncommitted(<f-args>)
|
command! -nargs=? GitCompare call <sid>git_diff(<f-args>)
|
||||||
command! Uncommitted call <sid>git_diff("HEAD")
|
|
||||||
" command! -nargs=1 GitAt call <sid>s:file_at_revision(<f-args>)
|
|
||||||
" Doesn't work for talos knows what reason
|
|
||||||
|
|
||||||
" === FILE STUFF ===
|
" === FILE STUFF ===
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue