nvim: autoload/git: Introduce a difftool version for git diff
This commit is contained in:
parent
c95289343a
commit
6ae7da9eca
2 changed files with 10 additions and 0 deletions
|
@ -5,6 +5,7 @@ nnoremap <buffer> <Leader>gB :call git#git_branch_delete()<CR>
|
|||
nnoremap <buffer> <Leader>gc :call git#git_cherry_pick()<CR>
|
||||
xnoremap <buffer> <Leader>gC :<C-U>call git#git_cherry_pick_range()<CR>
|
||||
nnoremap <buffer> <Leader>gd :call git#git_diff_commit()<CR>
|
||||
nnoremap <buffer> <Leader>gD :call git#git_difftool_commit()<CR>
|
||||
nnoremap <buffer> <Leader>gf :call git#git_format_patch()<CR>
|
||||
xnoremap <buffer> <Leader>gf :call git#git_format_patch_range()<CR>
|
||||
nnoremap <buffer> <Leader>gl :call git#git_branch_log()<CR>
|
||||
|
|
|
@ -110,6 +110,15 @@ function! git#git_diff_commit() abort
|
|||
execute "Gtabedit | Git diff " . commit[1] . "^ " . commit[1] . "| only"
|
||||
endfunction
|
||||
|
||||
" Run Git difftool on the commit in the line which we are at. To be used after
|
||||
" running some variation of Git log.
|
||||
function! git#git_difftool_commit() abort
|
||||
" A line in Git log is of the form commit <SHA>
|
||||
let line = trim(getline('.'))
|
||||
let commit = split(line, " ")
|
||||
execute "Gtabedit | Git difftool " . commit[1] . "^ " . commit[1]
|
||||
endfunction
|
||||
|
||||
" To be used after running some variation of Git log.
|
||||
function! git#git_format_patch() abort
|
||||
" A line in Git log is of the form commit <SHA>
|
||||
|
|
Loading…
Reference in a new issue