Skip to content

Commit 0f420d8

Browse files
committed
bugfix for auto-pair for js files
1 parent dbcde43 commit 0f420d8

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

autoload/easycomplete.vim

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3029,25 +3029,26 @@ function! easycomplete#StartUp()
30293029
endfunction
30303030

30313031
function! easycomplete#BufEnter()
3032+
" hack for autopair
3033+
if exists("g:AutoPairsMapCR") && g:AutoPairsMapCR == 1 && !exists("b:easycomplete_autopairs_loaded")
3034+
call timer_start(500, { -> easycomplete#UnmapCR() })
3035+
endif
30323036
if easycomplete#ok('g:easycomplete_diagnostics_enable')
30333037
if easycomplete#sources#deno#IsTSOrJSFiletype() && !easycomplete#sources#deno#IsDenoProject()
30343038
call easycomplete#sources#ts#bufEnter()
30353039
return
30363040
endif
30373041
call timer_start(1600, { -> easycomplete#lint() })
30383042
endif
3039-
" hack for autopair
3040-
if exists("g:AutoPairsMapCR") && g:AutoPairsMapCR == 1
3041-
call timer_start(500, { -> s:UnmapCR() })
3042-
endif
30433043
call s:flush()
30443044
endfunction
30453045

3046-
function s:UnmapCR()
3046+
function easycomplete#UnmapCR()
30473047
try
30483048
iunmap <buffer> <CR>
30493049
catch
30503050
endtry
3051+
let b:easycomplete_autopairs_loaded = 1
30513052
endfunction
30523053

30533054
function! easycomplete#finish()

0 commit comments

Comments
 (0)