summaryrefslogtreecommitdiff
path: root/autoload/ale/completion.vim
diff options
context:
space:
mode:
Diffstat (limited to 'autoload/ale/completion.vim')
-rw-r--r--autoload/ale/completion.vim20
1 files changed, 13 insertions, 7 deletions
diff --git a/autoload/ale/completion.vim b/autoload/ale/completion.vim
index 332d0734..4cf3a51a 100644
--- a/autoload/ale/completion.vim
+++ b/autoload/ale/completion.vim
@@ -269,13 +269,19 @@ function! s:ReplaceCompletionOptions(source) abort
let b:ale_old_completeopt = &l:completeopt
endif
- if &l:completeopt =~# 'preview'
- let &l:completeopt = 'menu,menuone,preview,noselect,noinsert'
- elseif &l:completeopt =~# 'popup'
- let &l:completeopt = 'menu,menuone,popup,noselect,noinsert'
- else
- let &l:completeopt = 'menu,menuone,noselect,noinsert'
- endif
+ let l:opt_list = split(&l:completeopt, ',')
+ " The menu and noinsert options must be set, or automatic completion
+ " will be annoying.
+ let l:new_opt_list = ['menu', 'menuone', 'noinsert']
+
+ " Permit some other completion options, provided users have set them.
+ for l:opt in ['preview', 'popup', 'noselect']
+ if index(l:opt_list, l:opt) >= 0
+ call add(l:new_opt_list, l:opt)
+ endif
+ endfor
+
+ let &l:completeopt = join(l:new_opt_list, ',')
endif
endfunction