summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-08-17 23:06:02 +0100
committerw0rp <devw0rp@gmail.com>2017-08-17 23:06:02 +0100
commit0a282eb76a344f8468e47859bcbda66d0a27d86d (patch)
treebd53b10b5f7de57dcd48cba3bcdb4373ae29e4cc /autoload
parent342e83db60dd929cbef1d00e1864e607760ca9bb (diff)
downloadale-0a282eb76a344f8468e47859bcbda66d0a27d86d.zip
Automatically adjust the completion options when using completion while you type
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/completion.vim10
1 files changed, 10 insertions, 0 deletions
diff --git a/autoload/ale/completion.vim b/autoload/ale/completion.vim
index f3d74cf0..07f755ea 100644
--- a/autoload/ale/completion.vim
+++ b/autoload/ale/completion.vim
@@ -115,11 +115,16 @@ function! ale#completion#Show(response, completion_parser) abort
let b:ale_old_omnifunc = &l:omnifunc
endif
+ if !exists('b:ale_old_completopt')
+ let b:ale_old_completopt = &l:completeopt
+ endif
+
" Set the list in the buffer, temporarily replace omnifunc with our
" function, and then start omni-completion.
let b:ale_completion_response = a:response
let b:ale_completion_parser = a:completion_parser
let &l:omnifunc = 'ale#completion#OmniFunc'
+ let &l:completeopt = 'menu,menuone,preview,noselect,noinsert'
call ale#completion#FeedKeys("\<C-x>\<C-o>", 'n')
endfunction
@@ -303,6 +308,11 @@ function! ale#completion#Done() abort
let &l:omnifunc = b:ale_old_omnifunc
unlet b:ale_old_omnifunc
endif
+
+ if exists('b:ale_old_completopt')
+ let &l:completeopt = b:ale_old_completopt
+ unlet b:ale_old_completopt
+ endif
endfunction
function! s:Setup(enabled) abort