aboutsummaryrefslogtreecommitdiffstats
path: root/plugin
diff options
context:
space:
mode:
authorTeddy Wing2020-09-20 23:28:36 +0200
committerTeddy Wing2020-09-20 23:48:59 +0200
commit3483e377e93e6381e2fea236ceb0e7d2991aa29e (patch)
treef96d2084037b2cd28e2c77f950d253f961e52659 /plugin
parentb6619da3a1ae5a44c8b05ac176e130f12da6661b (diff)
downloadvim-grappele-3483e377e93e6381e2fea236ceb0e7d2991aa29e.tar.bz2
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 `<Plug>` 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 `<Plug>Grappele` mapping for a measure of backward compatibility.
Diffstat (limited to 'plugin')
-rw-r--r--plugin/grappele.vim13
1 files changed, 11 insertions, 2 deletions
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 <silent> <Plug>Grappele :<c-u>call grappele#Grappele(v:count)<cr>
+nnoremap <silent> <Plug>Grappele :<c-u>call grappele#Grappele(v:count, 'n')<cr>
nnoremap <silent> <Plug>GrappeleRecall :<c-u>call grappele#Recall('n')<cr>
vnoremap <silent> <Plug>GrappeleRecall :<c-u>call grappele#Recall('v')<cr>
onoremap <silent> <Plug>GrappeleRecall :<c-u>call grappele#Recall('o')<cr>
if !hasmapto('<Plug>Grappele') || !maparg('G', 'n')
- nnoremap <silent> G :<c-u>call grappele#Grappele(v:count)<cr>
+ nnoremap <silent> G :<c-u>call grappele#Grappele(v:count, 'n')<cr>
+endif
+
+if !hasmapto('<Plug>Grappele') || !maparg('G', 'v')
+ vnoremap <silent> G
+ \ :<c-u>call grappele#Grappele(v:count, 'v', visualmode())<cr>
+endif
+
+if !hasmapto('<Plug>Grappele') || !maparg('G', 'o')
+ onoremap <silent> G :<c-u>call grappele#Grappele(v:count, 'o')<cr>
endif
if !hasmapto('<Plug>GrappeleRecall') || !maparg('gG', 'n')