diff options
author | Teddy Wing | 2020-09-20 23:28:36 +0200 |
---|---|---|
committer | Teddy Wing | 2020-09-20 23:48:59 +0200 |
commit | 3483e377e93e6381e2fea236ceb0e7d2991aa29e (patch) | |
tree | f96d2084037b2cd28e2c77f950d253f961e52659 /autoload/grappele.vim | |
parent | b6619da3a1ae5a44c8b05ac176e130f12da6661b (diff) | |
download | vim-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 'autoload/grappele.vim')
-rw-r--r-- | autoload/grappele.vim | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/autoload/grappele.vim b/autoload/grappele.vim index f9c7bd3..74af532 100644 --- a/autoload/grappele.vim +++ b/autoload/grappele.vim @@ -4,10 +4,13 @@ function! grappele#Grappele(line, ...) let l:column_offset = 0 let l:mode = get(a:, 1, '') + let l:visualmode = get(a:, 2, '') normal! m' if l:mode ==# 'v' + execute 'normal! ' . l:visualmode + elseif l:mode ==# 'o' normal! V endif @@ -28,6 +31,6 @@ endfunction function! grappele#Recall(mode) if exists('s:line') - call grappele#Grappele(s:line, a:mode) + call grappele#Grappele(s:line, a:mode, visualmode()) endif endfunction |