From 3483e377e93e6381e2fea236ceb0e7d2991aa29e Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 20 Sep 2020 23:28:36 +0200 Subject: Add operator pending and visual mode `G` mappings I previously added o- and v-maps for the `gG` mapping, but hadn't done so for `G`. This change allows us to reuse lines given to `G` from other modes. For example: 173>>..ygG Didn't use `` mappings here because after testing them, there was a noticeable delay. Found 07a75d523eadaf1027aa8bf287256602ad05f97f, which describes a performance penalty, so used direct mappings instead. Kept the `Grappele` mapping for a measure of backward compatibility. --- plugin/grappele.vim | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'plugin') diff --git a/plugin/grappele.vim b/plugin/grappele.vim index a0f0aa2..9ab1400 100644 --- a/plugin/grappele.vim +++ b/plugin/grappele.vim @@ -4,13 +4,22 @@ endif let g:loaded_grappele = 1 -nnoremap Grappele :call grappele#Grappele(v:count) +nnoremap Grappele :call grappele#Grappele(v:count, 'n') nnoremap GrappeleRecall :call grappele#Recall('n') vnoremap GrappeleRecall :call grappele#Recall('v') onoremap GrappeleRecall :call grappele#Recall('o') if !hasmapto('Grappele') || !maparg('G', 'n') - nnoremap G :call grappele#Grappele(v:count) + nnoremap G :call grappele#Grappele(v:count, 'n') +endif + +if !hasmapto('Grappele') || !maparg('G', 'v') + vnoremap G + \ :call grappele#Grappele(v:count, 'v', visualmode()) +endif + +if !hasmapto('Grappele') || !maparg('G', 'o') + onoremap G :call grappele#Grappele(v:count, 'o') endif if !hasmapto('GrappeleRecall') || !maparg('gG', 'n') -- cgit v1.2.3