diff options
author | Shougo Matsushita <Shougo.Matsu@gmail.com> | 2018-10-14 17:43:05 +0900 |
---|---|---|
committer | Shougo Matsushita <Shougo.Matsu@gmail.com> | 2018-11-08 21:34:17 +0900 |
commit | 3accc4a59ed2ed06b9cb15fffe3a029dc6c40def (patch) | |
tree | 2a394d268038e3031eec09e0d1566322bba4e659 | |
parent | d114d6f8c128dc9621be149c60b381d2cb2469d6 (diff) | |
download | deoplete.nvim-3accc4a59ed2ed06b9cb15fffe3a029dc6c40def.zip |
Add TextChangedP event support
-rw-r--r-- | autoload/deoplete/handler.vim | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/autoload/deoplete/handler.vim b/autoload/deoplete/handler.vim index 90de2ce..3079667 100644 --- a/autoload/deoplete/handler.vim +++ b/autoload/deoplete/handler.vim @@ -23,7 +23,12 @@ function! deoplete#handler#_init() abort call s:define_completion_via_timer('InsertEnter') endif if deoplete#custom#_get_option('refresh_always') - call s:define_completion_via_timer('InsertCharPre') + if exists('##TextChangedP') + autocmd deoplete InsertCharPre * let s:check_insert_charpre = v:true + call s:define_completion_via_timer('TextChangedP') + else + call s:define_completion_via_timer('InsertCharPre') + endif endif " Note: Vim 8 GUI(MacVim and Win32) is broken @@ -38,6 +43,8 @@ function! deoplete#handler#_init() abort " Note: Workaround autocmd deoplete VimLeavePre * call s:kill_yarp() endif + + let s:check_insert_charpre = v:false endfunction function! deoplete#handler#_do_complete() abort @@ -173,6 +180,12 @@ function! s:completion_begin(event) abort \ 'deoplete_auto_completion_begin', {'event': a:event}) endfunction function! s:is_skip(event) abort + if a:event ==# 'TextChangedP' && !s:check_insert_charpre + return 1 + endif + + let s:check_insert_charpre = v:false + if s:is_skip_text(a:event) return 1 endif |