From 241f315eec318c6c064d0287e7a5597cda8d8ede Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Wed, 30 Mar 2022 14:36:40 +0200 Subject: [PATCH] vim:keys: Add more git mappings --- .config/vim/vimrc.d/40-keys.vim | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.config/vim/vimrc.d/40-keys.vim b/.config/vim/vimrc.d/40-keys.vim index 54065ff..ca45466 100644 --- a/.config/vim/vimrc.d/40-keys.vim +++ b/.config/vim/vimrc.d/40-keys.vim @@ -120,7 +120,25 @@ if exists('g:loaded_fugitive') nnoremap gcd :Gcd else " only works if a file is already opened - nnoremap cd :cd %:h cd `git rev-parse --show-toplevel` + nnoremap gcd :cd %:h cd `git rev-parse --show-toplevel` +endif + +if exists('g:loaded_gitgutter') + " Add `g` prefix to hunk bindings + nmap ghs (GitGutterStageHunk) + xmap ghs (GitGutterStageHunk) + nmap ghu (GitGutterUndoHunk) + nmap ghp (GitGutterPreviewHunk) + + " Add hunk/h version to textobject bindings that use `c` (for `change I + " presume?) (e.g. ic -> ih) + omap ih (GitGutterTextObjectInnerPending) + omap ah (GitGutterTextObjectOuterPending) + xmap ih (GitGutterTextObjectInnerVisual) + xmap ah (GitGutterTextObjectOuterVisual) + " Same for hunk navigation bindings + nmap [h (GitGutterPrevHunk) + nmap ]h (GitGutterNextHunk) endif " Y should behave like D & C does