diff --git a/plugin/auto-pairs.vim b/plugin/auto-pairs.vim index a86467f..633a589 100644 --- a/plugin/auto-pairs.vim +++ b/plugin/auto-pairs.vim @@ -273,9 +273,14 @@ function! AutoPairsFastWrap() endfunction function! AutoPairsMap(key) - let escaped_key = substitute(a:key, "'", "''", 'g') + " | is special key which separate map command from text + let key = a:key + if key == '|' + let key = '' + end + let escaped_key = substitute(key, "'", "''", 'g') " use expr will cause search() doesn't work - execute 'inoremap '.a:key." =AutoPairsInsert('".escaped_key."')" + execute 'inoremap '.key." =AutoPairsInsert('".escaped_key."')" endfunction function! AutoPairsToggle()