vim:keys: Fix <leader>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<Esc>` which places the cursor on the end of the current word independent of the placement of the cursor.
This commit is contained in:
@@ -109,7 +109,7 @@ nnoremap <expr> 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 <leader>grc :let subject=system('git show -s --format="(\"%s\")" <C-R><C-W>')<CR>ea <C-R>=subject[:-2]<CR><Esc>
|
||||
nmap <leader>grc :let subject=system('git show -s --format="(\"%s\")" <C-R><C-W>')<CR>viw<Esc>a <C-R>=subject[:-2]<CR><Esc>
|
||||
|
||||
" Insert a Signed-off-by trailer
|
||||
nmap <leader>gso :r!git config --get user.name<CR>:r!git config --get user.email<CR>I<<ESC>A><ESC>kJISigned-off-by: <ESC>
|
||||
|
||||
Reference in New Issue
Block a user