nvim: lua: plugins: Add diffview
Also add a helper on lines similar to Git difftool from fugitive.
This commit is contained in:
parent
5ce14b4cc7
commit
b064bb14a9
3 changed files with 12 additions and 1 deletions
|
@ -3,7 +3,8 @@ autocmd! BufEnter <buffer> DisableWhitespace
|
|||
|
||||
nmap <buffer> <Leader>gb :call git#git_branch_checkout()<CR>
|
||||
nmap <buffer> <Leader>gB :call git#git_branch_delete()<CR>
|
||||
nmap <buffer> <Leader>gd :call git#git_diff_commit()<CR>
|
||||
nmap <buffer> <Leader>gd :call git#git_diffview_commit()<CR>
|
||||
nmap <buffer> <Leader>gD :call git#git_diff_commit()<CR>
|
||||
nmap <buffer> <Leader>gl :call git#git_branch_log()<CR>
|
||||
nmap <buffer> <Leader>gL :call git#git_branch_log_pretty()<CR>
|
||||
nmap <buffer> <Leader>gp :call git#git_cherry_pick()<CR>
|
||||
|
|
|
@ -103,6 +103,15 @@ function! git#git_diff_commit() abort
|
|||
silent execute "Git difftool -y " . commit[1] . "^!"
|
||||
endfunction
|
||||
|
||||
" Run DiffviewOpen on the commit in the line which we are at. To be used after
|
||||
" running some variation of Git log.
|
||||
function! git#git_diffview_commit() abort
|
||||
" A line in Git log is of the form commit <SHA>
|
||||
let line = trim(getline('.'))
|
||||
let commit = split(line, " ")
|
||||
silent execute "DiffviewOpen " . commit[1] . "^!"
|
||||
endfunction
|
||||
|
||||
" The next two functions allow scoping diffs by line range of a file and named
|
||||
" block in a file. Inspired by reading the following article.
|
||||
" https://susanpotter.net/software/tracking-diffs-by-scoping-to-file-range-function-method-or-class-changes-in-git/
|
||||
|
|
|
@ -45,6 +45,7 @@ local init = function ()
|
|||
use 'rhysd/conflict-marker.vim'
|
||||
use 'salcode/vim-interactive-rebase-reverse'
|
||||
use 'whiteinge/diffconflicts'
|
||||
use 'sindrets/diffview.nvim'
|
||||
-- Boost vim command line mode
|
||||
use 'vim-utils/vim-husk'
|
||||
-- Rainbow Parentheses
|
||||
|
|
Loading…
Reference in a new issue