summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShougo Matsushita <Shougo.Matsu@gmail.com>2020-11-20 19:12:46 +0900
committerShougo Matsushita <Shougo.Matsu@gmail.com>2020-11-20 19:12:46 +0900
commita39f78f5e599ef29cc15c46c352ec5560e0f8e73 (patch)
tree220aaf339c3f074a8372d3d58ea67f854c9575dc
parent8249a0f2f27a84aa33116e392f4e79bcb20864b8 (diff)
downloaddeoplete.nvim-a39f78f5e599ef29cc15c46c352ec5560e0f8e73.zip
Fix #1149 add refresh_backspace option
-rw-r--r--autoload/deoplete/handler.vim23
-rw-r--r--autoload/deoplete/init.vim2
-rw-r--r--doc/deoplete.txt7
3 files changed, 22 insertions, 10 deletions
diff --git a/autoload/deoplete/handler.vim b/autoload/deoplete/handler.vim
index bf98ce5..8ff2023 100644
--- a/autoload/deoplete/handler.vim
+++ b/autoload/deoplete/handler.vim
@@ -186,8 +186,20 @@ endfunction
function! deoplete#handler#_completion_begin(event) abort
call deoplete#custom#_update_cache()
- if s:is_skip(a:event)
+ let auto_popup = deoplete#custom#_get_option(
+ \ 'auto_complete_popup') !=# 'manual'
+ let prev_input = get(g:deoplete#_context, 'input', '')
+ let cur_input = deoplete#util#get_input(a:event)
+
+ let check_back_space = auto_popup
+ \ && cur_input !=# prev_input
+ \ && len(cur_input) + 1 ==# len(prev_input)
+ \ && stridx(prev_input, cur_input) == 0
+ let refresh_backspace = deoplete#custom#_get_option('refresh_backspace')
+
+ if s:is_skip(a:event) || (check_back_space && !refresh_backspace)
let g:deoplete#_context.candidates = []
+ let g:deoplete#_context.input = cur_input
return
endif
@@ -201,14 +213,7 @@ function! deoplete#handler#_completion_begin(event) abort
\ 'deoplete_auto_completion_begin', {'event': a:event})
" For <BS> popup flicker
- let auto_popup = deoplete#custom#_get_option(
- \ 'auto_complete_popup') !=# 'manual'
- let prev_input = get(g:deoplete#_context, 'input', '')
- let cur_input = deoplete#util#get_input(a:event)
- if auto_popup && empty(v:completed_item)
- \ && cur_input !=# prev_input
- \ && len(cur_input) + 1 ==# len(prev_input)
- \ && stridx(prev_input, cur_input) == 0
+ if check_back_space && empty(v:completed_item)
call feedkeys("\<Plug>_", 'i')
endif
endfunction
diff --git a/autoload/deoplete/init.vim b/autoload/deoplete/init.vim
index e181e81..e848392 100644
--- a/autoload/deoplete/init.vim
+++ b/autoload/deoplete/init.vim
@@ -236,7 +236,6 @@ function! s:check_custom_option(old_var, new_var) abort
endfunction
function! deoplete#init#_option() abort
- " Note: HTML omni func use search().
return {
\ 'auto_complete': v:true,
\ 'auto_complete_delay': 0,
@@ -259,6 +258,7 @@ function! deoplete#init#_option() abort
\ 'prev_completion_mode': '',
\ 'profile': v:false,
\ 'refresh_always': v:true,
+ \ 'refresh_backspace': v:true,
\ 'skip_chars': ['(', ')'],
\ 'skip_multibyte': v:false,
\ 'smart_case': &smartcase,
diff --git a/doc/deoplete.txt b/doc/deoplete.txt
index a42c854..573da68 100644
--- a/doc/deoplete.txt
+++ b/doc/deoplete.txt
@@ -304,6 +304,13 @@ refresh_always
Default value: v:true
+ *deoplete-options-refresh_backspace*
+refresh_backspace
+ Deoplete refreshes the candidates automatically when you
+ press <BS> or <C-h> key.
+
+ Default value: v:true
+
*deoplete-options-skip_multibyte*
skip_multibyte
Deoplete skip multibyte text completion automatically if this