diff --git a/.config/vim/vimrc.d/40-keys.vim b/.config/vim/vimrc.d/40-keys.vim index 04b3be4..0610ded 100644 --- a/.config/vim/vimrc.d/40-keys.vim +++ b/.config/vim/vimrc.d/40-keys.vim @@ -140,12 +140,14 @@ nnoremap gp '`[' . strpart(getregtype(), 0, 1) . '`]' " Git bindings -" Insert a commit's subject behind the SHA1 that the cursor is currently on. -" Mnemonic: "git reference commit" +" Reference the commit that the cursor is currently on with the 'reference' +" format (Mnemonic: "git reference commit"). +" NOTE: I can't use --pretty=reference since it would insert the abbreviated +" hash additionally to the existing hash. " NOTE: This uses `system` and not `:r!` to insert the text directly at the -" cursor. `subject[:-2]` cuts off the trailing newline. +" cursor. `subject[:-1]` cuts off the trailing newline. " TODO: print error message but insert nothing on git error -nmap grc :let subject=system('git show -s --format="(\"%s\")" ')viwa =subject[:-2] +nmap grc :let subject=system('git show -s --date=short --pretty="format:(%s, %ad)" ')viwa =subject[:-1] " Insert a Signed-off-by trailer nmap gso :r!git config --get user.name:r!git config --get user.emailI<A>kJISigned-off-by: