This repository was archived by the owner on Oct 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 74
Expand file tree
/
Copy pathcompletion.vim
More file actions
47 lines (42 loc) · 1.54 KB
/
completion.vim
File metadata and controls
47 lines (42 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
" Perform a Hack to confirm completion
function! completion#completion_confirm() abort
lua require'completion'.confirmCompletion()
call nvim_feedkeys("\<C-Y>", "n", v:true)
endfunction
function! completion#wrap_completion() abort
if pumvisible() != 0
if complete_info()["selected"] != "-1"
call completion#completion_confirm()
else
call nvim_feedkeys("\<c-e>", "n", v:true)
let key = g:completion_confirm_key
call nvim_feedkeys(key, "n", v:true)
endif
else
call nvim_feedkeys("\<c-g>\<c-g>", "n", v:true)
let key = g:completion_confirm_key
call nvim_feedkeys(key, "n", v:true)
endif
endfunction
" Wrapper to get manually trigger working
" Please send me a pull request if you know how to do this properly...
function! completion#completion_wrapper()
lua require'completion'.triggerCompletion()
return ''
endfunction
function! completion#trigger_completion()
return "\<c-r>=completion#completion_wrapper()\<CR>"
endfunction
" Wrapper of getting buffer variable
" Avoid accessing to unavailable variable
function! completion#get_buffer_variable(str)
return get(b:, a:str, v:null)
endfunction
function! completion#enable_in_comment()
let l:list = g:completion_chain_complete_list
if type(l:list) == v:t_dict && has_key(l:list, 'default')
\ && type(l:list.default) == v:t_dict
\ && has_key(l:list.default, 'comment')
call remove(g:completion_chain_complete_list, 'comment')
endif
endfunction