blob: 81751ba89d77bcea93bfc581eb0de9191b5c2412 (
plain)
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
48
49
50
51
52
53
|
if has('nvim')
finish
endif
let g:mucomplete#enable_auto_at_startup = 1
let g:mucomplete#minimum_prefix_length = 1
let g:mucomplete#empty_text_auto = 1
let g:mucomplete#no_mappings = 1
let g:mucomplete#can_complete = {}
let s:default_cond = { t -> strlen(&omnifunc) > 0 && t =~# '\%(\.\)$' }
let g:mucomplete#can_complete.default = { 'omni': s:default_cond }
let g:mucomplete#chains = {}
let g:mucomplete#chains.default =
\ [ 'ulti', 'user', 'omni', 'keyn', 'path' ]
let s:c_cond = { t -> strlen(&omnifunc) > 0 && t =~# '\%(\.\|->\)$' }
let g:mucomplete#can_complete.c = { 'omni': s:c_cond }
let g:mucomplete#can_complete.objc = { 'omni': s:c_cond }
let s:cpp_cond = { t -> strlen(&omnifunc) > 0 && t =~# '\%(\.\|->\|::\)$' }
let g:mucomplete#can_complete.cpp = { 'omni': s:cpp_cond }
let g:mucomplete#can_complete.objcpp = { 'omni': s:cpp_cond }
let g:mucomplete#can_complete.cuda = { 'omni': s:cpp_cond }
imap <s-tab> <plug>(MUcompleteBwd)
imap <expr> <c-g><c-g> pumvisible() ? "\<plug>(MUcompleteOut)" : "\<esc>"
" Integrate with UltiSnips
inoremap <silent> <expr> <plug>MyCR
\ mucomplete#ultisnips#expand_snippet("\<cr>")
imap <cr> <plug>MyCR
let g:ulti_expand_or_jump_res = 0
fun! TryUltiSnips()
if !pumvisible() " With the pop-up menu open, let Tab move down
call UltiSnips#ExpandSnippetOrJump()
endif
return ''
endf
fun! TryMUcomplete()
return g:ulti_expand_or_jump_res ? "" : "\<plug>(MUcompleteFwd)"
endf
inoremap <plug>(TryUlti) <c-r>=TryUltiSnips()<cr>
imap <expr> <silent> <plug>(TryMU) TryMUcomplete()
imap <expr> <silent> <tab> "\<plug>(TryUlti)\<plug>(TryMU)"
packadd vim-mucomplete
|