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. --- autoload/grappele.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'autoload') 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 -- cgit v1.2.3