diff --git a/autoload/autopairs/Keybinds.vim b/autoload/autopairs/Keybinds.vim index bf48124..d92a7ce 100644 --- a/autoload/autopairs/Keybinds.vim +++ b/autoload/autopairs/Keybinds.vim @@ -198,54 +198,28 @@ endfun fun! autopairs#Keybinds#mapKeys() - " TODO: decode this comment - " for auto-pairs starts with 'a', so the priority is higher than supertab and vim-endwise + " This bit of code attempts to be compatible with other plugins. + " It isn't always successful (:h autopairs-bad-cr), which is + " overwhelmingly caused by other plugins doing weird shit with their + " functions, in a way that often expects dedicated `` access. " - " vim-endwise doesn't support AutoPairsReturn - " when use AutoPairsReturn will cause isn't expanded - " - " supertab doesn't support AutoPairsReturn - " when use AutoPairsReturn will cause Duplicated - " - " and when load after vim-endwise will cause unexpected endwise inserted. - " so always load AutoPairs at last - - " Buffer level keys mapping - " comptible with other plugin + " This leads to incompatibilities, some of which were previously listed in + " a comment here, but have been moved to :h autopairs-incompatible-cr, at + " least for plugins that have a confirmed incompatibility if b:AutoPairsMapCR - if v:version == 703 && has('patch32') || v:version > 703 - " VIM 7.3 supports advancer maparg which could get info - " then auto-pairs could remap in any case. - let info = maparg(g:AutoPairsCRKey, 'i', 0, 1) - if empty(info) - " Not _entirely_ sure if this should be or - " g:AutoPairsCRKey. - let old_cr = '' - let is_expr = 0 - else - let old_cr = info['rhs'] - let old_cr = autopairs#Keybinds#ExpandMap(old_cr) - let old_cr = substitute(old_cr, '', '' .. info['sid'] .. '_', 'g') - let is_expr = info['expr'] - let wrapper_name = 'AutoPairsOldCRWrapper73' - endif + " VIM 7.3 supports the advanced maparg, which can get info + let info = maparg(g:AutoPairsCRKey, 'i', 0, 1) + if empty(info) + " Not _entirely_ sure if this should be or + " g:AutoPairsCRKey. + let old_cr = '' + let is_expr = 0 else - " VIM version less than 7.3 - " the mapping's info is lost, so guess it is expr or not, it's - " not accurate. - let old_cr = maparg(b:AutoPairsCRKey, 'i') - if old_cr == '' - let old_cr = '' - let is_expr = 0 - else - let old_cr = autopairs#Keybinds#ExpandMap(old_cr) - " old_cr contain (, I guess the old cr is in expr mode - let is_expr = old_cr =~ '\V(' && toupper(old_cr) !~ '\V' - - " The old_cr start with " it must be in expr mode - let is_expr = is_expr || old_cr =~ '\v^"' - let wrapper_name = 'AutoPairsOldCRWrapper' - endif + let old_cr = info['rhs'] + let old_cr = autopairs#Keybinds#ExpandMap(old_cr) + let old_cr = substitute(old_cr, '', '' .. info['sid'] .. '_', 'g') + let is_expr = info['expr'] + let wrapper_name = 'AutoPairsOldCRWrapper73' endif if old_cr !~ 'AutoPairsReturn' @@ -273,16 +247,9 @@ fun! autopairs#Keybinds#mapKeys() end if b:AutoPairsMapSpace - " Try to respect abbreviations on a - let do_abbrev = "" - " neovim appears to set v:version to 800, so it should be compatible - " with this. - " Admittedly, probably not compatible with the same version checks, - " but hey, it's fine. - if v:version == 703 && has("patch489") || v:version > 703 - let do_abbrev = "" - endif - execute 'inoremap ' .. do_abbrev .. '=autopairs#AutoPairsSpace()' + + " is required to respect abbreviations + execute 'inoremap =autopairs#AutoPairsSpace()' end if b:AutoPairsShortcutFastWrap != '' diff --git a/autoload/autopairs/Strings.vim b/autoload/autopairs/Strings.vim index faababf..00b91a8 100644 --- a/autoload/autopairs/Strings.vim +++ b/autoload/autopairs/Strings.vim @@ -2,14 +2,11 @@ if !has('nvim') && has('vimscript-4') scriptversion 4 endif -" 7.4.849 support U to avoid breaking '.' -" Issue talk: https://github.com/jiangmiao/auto-pairs/issues/3 -" Vim note: https://github.com/vim/vim/releases/tag/v7.4.849 -if v:version > 704 || v:version == 704 && has("patch849") - let g:autopairs#Strings#Go = "\U" -else - let g:autopairs#Strings#Go = "" -endif + +" This statement previously had a version check, but it has been removed as +" that check isn't necessary anymore. A newer version is enforced, so this is +" guaranteed supported +let g:autopairs#Strings#Go = "\U" let g:autopairs#Strings#Left = g:autopairs#Strings#Go.."\" let g:autopairs#Strings#Right = g:autopairs#Strings#Go.."\" diff --git a/autoload/autopairs/Variables.vim b/autoload/autopairs/Variables.vim index 85410f5..ca213c0 100644 --- a/autoload/autopairs/Variables.vim +++ b/autoload/autopairs/Variables.vim @@ -11,10 +11,6 @@ fun! s:define(name, default) endif endfun -fun! autopairs#Variables#_InitVariables() - echoerr "This function has been renamed. Use autopairs#Variables#InitVariables instead (note the missing _)" -endfun - " TODO: sort this garbage fun! autopairs#Variables#InitVariables() " Default autopairs