summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorShougo Matsushita <Shougo.Matsu@gmail.com>2017-06-24 16:36:10 +0900
committerShougo Matsushita <Shougo.Matsu@gmail.com>2017-06-24 16:53:49 +0900
commit49362f71d6dea30549db2f145a53ca672046b9af (patch)
treef03ef980a0e03ee6619b8d895ad9a1f002a73366 /autoload
parentd77939db7e915e14131f24fc63f38220c7c3f550 (diff)
downloaddeoplete.nvim-49362f71d6dea30549db2f145a53ca672046b9af.zip
Improve exit
Diffstat (limited to 'autoload')
-rw-r--r--autoload/deoplete/handler.vim11
1 files changed, 9 insertions, 2 deletions
diff --git a/autoload/deoplete/handler.vim b/autoload/deoplete/handler.vim
index a25de34..b0aa031 100644
--- a/autoload/deoplete/handler.vim
+++ b/autoload/deoplete/handler.vim
@@ -8,11 +8,12 @@ function! deoplete#handler#_init() abort
augroup deoplete
autocmd!
autocmd InsertLeave * call s:on_insert_leave()
- autocmd CompleteDone * call s:complete_done()
+ autocmd CompleteDone * call s:on_complete_done()
autocmd TextChangedI * call s:completion_begin('TextChangedI')
autocmd InsertEnter *
\ call s:completion_begin('InsertEnter') | call s:timer_begin()
autocmd InsertLeave * call s:timer_end()
+ autocmd VimLeavePre * call s:on_vimleave()
augroup END
for event in ['BufNewFile', 'BufRead', 'BufWritePost']
@@ -197,7 +198,7 @@ function! s:on_insert_leave() abort
let g:deoplete#_context = {}
endfunction
-function! s:complete_done() abort
+function! s:on_complete_done() abort
if get(v:completed_item, 'word', '') !=# ''
let word = v:completed_item.word
if !has_key(g:deoplete#_rank, word)
@@ -212,6 +213,12 @@ function! s:complete_done() abort
endif
endfunction
+function! s:on_vimleave() abort
+ if exists('g:deoplete#_channel_id')
+ call rpcstop(g:deoplete#_channel_id)
+ endif
+endfunction
+
function! deoplete#handler#_skip_next_completion() abort
if !exists('g:deoplete#_context')
return