summaryrefslogtreecommitdiff
path: root/autoload/deoplete/handler.vim
diff options
context:
space:
mode:
Diffstat (limited to 'autoload/deoplete/handler.vim')
-rw-r--r--autoload/deoplete/handler.vim16
1 files changed, 16 insertions, 0 deletions
diff --git a/autoload/deoplete/handler.vim b/autoload/deoplete/handler.vim
index b1895f1..e355063 100644
--- a/autoload/deoplete/handler.vim
+++ b/autoload/deoplete/handler.vim
@@ -363,11 +363,27 @@ endfunction
function! s:on_complete_done() abort
if get(v:completed_item, 'word', '') ==# ''
+ \ || !has_key(g:deoplete#_context, 'complete_str')
return
endif
call deoplete#handler#_skip_next_completion()
+ let max_used = 100
+ let g:deoplete#_recently_used = insert(
+ \ g:deoplete#_recently_used,
+ \ tolower(v:completed_item.word),
+ \ )
+ let min_pattern_length = deoplete#custom#_get_option('min_pattern_length')
+ if len(g:deoplete#_context['complete_str']) > min_pattern_length
+ let g:deoplete#_recently_used = insert(
+ \ g:deoplete#_recently_used,
+ \ tolower(g:deoplete#_context['complete_str']),
+ \ )
+ endif
+ let g:deoplete#_recently_used = deoplete#util#uniq(
+ \ g:deoplete#_recently_used)[: max_used]
+
let user_data = get(v:completed_item, 'user_data', '')
if type(user_data) !=# v:t_string || user_data ==# ''
return