diff --git a/plugin/auto-pairs.vim b/plugin/auto-pairs.vim index d25d030..3261f84 100644 --- a/plugin/auto-pairs.vim +++ b/plugin/auto-pairs.vim @@ -170,6 +170,7 @@ function! AutoPairsReturn() endfunction function! AutoPairsInit() + let b:autopairs_loaded = 1 let b:autopairs_enabled = 1 for [open, close] in items(g:AutoPairs) call AutoPairsMap(open) @@ -198,4 +199,12 @@ function! AutoPairsInit() end endfunction -au BufRead,BufNewFile,BufCreate,VimEnter * :call AutoPairsInit() +function! AutoPairsForceInit() + if exists('b:autopairs_loaded') + return + else + call AutoPairsInit() + endif +endfunction + +au BufEnter * :call AutoPairsForceInit()