From 158dcb4b96f4600432a3bfe00c451c9cc6a4f2a5 Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Fri, 13 May 2022 17:05:03 +0200 Subject: [PATCH] vim:keys: Add mapping to insert commit subject Insert a commit's subject behind the SHA1 that the cursor is currently on with `grc`. Mnemonic: "git reference commit" --- .config/vim/vimrc.d/40-keys.vim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.config/vim/vimrc.d/40-keys.vim b/.config/vim/vimrc.d/40-keys.vim index a0c349f..e918cd7 100644 --- a/.config/vim/vimrc.d/40-keys.vim +++ b/.config/vim/vimrc.d/40-keys.vim @@ -110,6 +110,10 @@ vnoremap # y?\V=escape(@",'?\') " Taken from: https://vim.fandom.com/wiki/Selecting_your_pasted_text 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" +nmap grc yiweak:r!git show -s --format='("\%s")' 0kJJ if exists('g:loaded_fugitive') nmap gc :G commit