Enable :w in preview window to stage the hunk.

This commit is contained in:
Andy Stewart
2019-08-21 10:27:23 +01:00
parent 46f15ed42a
commit 77fb3fd81e
4 changed files with 43 additions and 2 deletions

View File

@@ -315,6 +315,10 @@ function! s:preview(hunk_diff)
call setline(1, body)
normal! gg
cnoreabbrev <buffer> <expr> w getcmdtype() == ':' && getcmdline() == 'w' ? 'GitGutterStageHunk' : 'w'
" Staging hunk from the preview window closes the window anyway.
cnoreabbrev <buffer> <expr> wq getcmdtype() == ':' && getcmdline() == 'wq' ? 'GitGutterStageHunk' : 'wq'
noautocmd wincmd p
endfunction