From 648034ccb851782d12f0e57c7cfae1f3427185ec Mon Sep 17 00:00:00 2001 From: Paul Jolly Date: Sun, 14 Jul 2019 10:49:18 +0100 Subject: [PATCH] Paramterise AutoPairsFastWrap() to allow for custom movements By defining a movement parameter for AutoPairsFastWrap, we allow the user to define addition fast-wrap style mappings, for example: inoremap =AutoPairsFastWrap("E") inoremap =AutoPairsFastWrap("$") Whilst it might, in the future, seem appropriate/sensible/whatever to add these as default mapping to auto-pairs, this change allows experimentation in the short term. --- plugin/auto-pairs.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugin/auto-pairs.vim b/plugin/auto-pairs.vim index af5eb32..6a15289 100644 --- a/plugin/auto-pairs.vim +++ b/plugin/auto-pairs.vim @@ -334,7 +334,7 @@ endf " Fast wrap the word in brackets -func! AutoPairsFastWrap() +func! AutoPairsFastWrap(movement) let c = @" normal! x let [before, after, ig] = s:getline() @@ -354,7 +354,7 @@ func! AutoPairsFastWrap() end endfor if after[1:1] =~ '\v\w' - normal! e + execute "normal! ".a:movement normal! p else normal! p @@ -559,7 +559,7 @@ func! AutoPairsInit() end if g:AutoPairsShortcutFastWrap != '' - execute 'inoremap '.g:AutoPairsShortcutFastWrap.' =AutoPairsFastWrap()' + execute 'inoremap '.g:AutoPairsShortcutFastWrap.' =AutoPairsFastWrap("e")' end if g:AutoPairsShortcutBackInsert != ''