vim:keys: Add mapping to insert commit subject

Insert a commit's subject behind the SHA1 that the cursor is currently
on with `<leader>grc`.

Mnemonic: "git reference commit"
This commit is contained in:
2022-05-13 17:05:03 +02:00
parent c86b1b765a
commit 158dcb4b96

View File

@@ -110,6 +110,10 @@ vnoremap # y?\V<C-R>=escape(@",'?\')<CR><CR>
" Taken from: https://vim.fandom.com/wiki/Selecting_your_pasted_text " Taken from: https://vim.fandom.com/wiki/Selecting_your_pasted_text
nnoremap <expr> gp '`[' . strpart(getregtype(), 0, 1) . '`]' nnoremap <expr> 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 <leader>grc yiwea<CR><Esc>k:r!git show -s --format='("\%s")' <C-R>0<CR>kJJ
if exists('g:loaded_fugitive') if exists('g:loaded_fugitive')
nmap <leader>gc :G commit<CR> nmap <leader>gc :G commit<CR>