From 6930d9b2d9df1ed0ec7f6eed3e8a9c0fe72dfb9f Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Mon, 23 Jan 2023 19:52:07 +0100 Subject: [PATCH] vim:keys: Fix grc when on end of hash When the cursor is on the last character of the hash (e.g. after pasting), the mapping would break and insert the commit subject behind the next word. Fix this by using `viw` which places the cursor on the end of the current word independent of the placement of the cursor. --- .config/vim/vimrc.d/40-keys.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/vim/vimrc.d/40-keys.vim b/.config/vim/vimrc.d/40-keys.vim index 93c26b5..749c3e3 100644 --- a/.config/vim/vimrc.d/40-keys.vim +++ b/.config/vim/vimrc.d/40-keys.vim @@ -109,7 +109,7 @@ nnoremap gp '`[' . strpart(getregtype(), 0, 1) . '`]' " Mnemonic: "git reference commit" " NOTE: This uses `system` and not `:r!` to insert the text directly at the " cursor. `subject[:-2]` cuts off the trailing newline. -nmap grc :let subject=system('git show -s --format="(\"%s\")" ')ea =subject[:-2] +nmap grc :let subject=system('git show -s --format="(\"%s\")" ')viwa =subject[:-2] " Insert a Signed-off-by trailer nmap gso :r!git config --get user.name:r!git config --get user.emailI<A>kJISigned-off-by: