From e07089624f0f8b8ba3f024bbf3c0c1a735522d06 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 26 Sep 2020 22:24:54 +0200 Subject: Fix `gG` omap by removing count Previously, if we stored a number in `s:line`, for example with `17G`, then `>gG` would cause lines .,17 to be indented 17 times due to the use of `V`. When I removed `V` from the omap, any commands using `gG` operated characterwise, when they should operate linewise. Found this answer from Liu Sha (https://stackoverflow.com/users/7026980/liu-sha) https://stackoverflow.com/questions/4261177/discarding-count-in-expr-mappings/53182922#53182922 that shows how to discard the count for different types of mappings: > nnoremap s "@_" . ToNthSpace() > vnoremap s "@_" . ToNthSpace() > onoremap s printf(":normal %s\", ToNthSpace()) The `:normal!` looks like it discards the count, so this gives us what we want. Adapted the suggestion into a new `` omap that indents only once for e.g. .,17. --- plugin/grappele.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugin') diff --git a/plugin/grappele.vim b/plugin/grappele.vim index e04c8e4..21c5cc7 100644 --- a/plugin/grappele.vim +++ b/plugin/grappele.vim @@ -7,7 +7,7 @@ let g:loaded_grappele = 1 nnoremap Grappele grappele#Grappele(v:count, 'n') nnoremap GrappeleRecall :call grappele#Recall('n') vnoremap GrappeleRecall :call grappele#Recall('v') -onoremap GrappeleRecall :call grappele#Recall('o') +onoremap GrappeleRecall grappele#ORecall() if !hasmapto('Grappele') || !maparg('G', 'n') nnoremap G grappele#Grappele(v:count, 'n') -- cgit v1.2.3