From 82ea023514f3db43ff7def33f43f11b1a98fb064 Mon Sep 17 00:00:00 2001 From: Jerome Reybert <jreybert@gmail.com> Date: Mon, 7 Aug 2017 18:17:34 +0200 Subject: [PATCH] fix <C-n> issue with mapping_wrapper() ctrl mapping is not well handled with mapping_wrapper() function, culprit may be the <C- interpreted somewhere... Workaround is to directly map the command when no section regex is provided to mg_set_mapping function. error message: E114: Missing quote: " E116: Invalid arguments for function <SNR>134_mapping_wrapper --- autoload/magit/mapping.vim | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/autoload/magit/mapping.vim b/autoload/magit/mapping.vim index 52ba252..92d7d7f 100644 --- a/autoload/magit/mapping.vim +++ b/autoload/magit/mapping.vim @@ -73,14 +73,20 @@ endfunction " param[in] function the function to call (rhs) " param[in] ... : optional, section, the regex of the section(s) function! s:mg_set_mapping(mode, mapping, function, ...) - execute a:mode . "noremap <buffer><silent><nowait> " - \ . a:mapping . - \ " :call <SID>mapping_wrapper(\"" . - \ a:mapping . "\", \"" . - \ a:function . "\"" . - \ ( ( a:0 == 1 ) ? - \ ", \'" . a:1 . "\'" : '' ) - \ . ")<cr>" + if ( a:0 == 1 ) + execute a:mode . "noremap <buffer><silent><nowait> " + \ . a:mapping . + \ " :call <SID>mapping_wrapper(\"" . + \ a:mapping . "\", \"" . + \ a:function . "\"" . + \ ", \'" . a:1 . "\'" . + \ ")<cr>" + else + execute a:mode . "noremap <buffer><silent><nowait> " + \ . a:mapping . + \ " :call " . + \ a:function . "<cr>" + endif endfunction function! magit#mapping#set_default() -- GitLab