summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2021-06-19 10:57:34 +0100
committerw0rp <devw0rp@gmail.com>2021-06-19 10:57:34 +0100
commite78519683e5320971faa7fe5c9dd8c0dd6fd3100 (patch)
treeeb4b257b5f3376fd79082b9f3d0f68ed318140d1 /autoload
parent84a4a76aafaefe125df785ebac2e4858ec54debb (diff)
downloadale-e78519683e5320971faa7fe5c9dd8c0dd6fd3100.zip
Close #3433 - Only use noselect if set for automatic completion
Diffstat (limited to 'autoload')
-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