From 1c7efda5be438f9e864d1401a3feb3c320a652b3 Mon Sep 17 00:00:00 2001 From: Guangxiong Lin Date: Sat, 9 Apr 2022 00:10:47 +0800 Subject: Integrate mucomplete with ultisnips (vim) --- .vim/after/plugin/mucomplete.vim | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to '.vim/after/plugin') diff --git a/.vim/after/plugin/mucomplete.vim b/.vim/after/plugin/mucomplete.vim index 98146aa..788ddf6 100644 --- a/.vim/after/plugin/mucomplete.vim +++ b/.vim/after/plugin/mucomplete.vim @@ -1,7 +1,7 @@ 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 -> t =~# '\%(\.\)$' } @@ -9,5 +9,29 @@ let g:mucomplete#can_complete.default = { 'omni': s:default_cond } let g:mucomplete#chains = {} let g:mucomplete#chains.default = [ 'ulti', 'user', 'omni', 'keyn', 'path' ] +imap (MUcompleteBwd) + +" Integrate with UltiSnips + +inoremap MyCR + \ mucomplete#ultisnips#expand_snippet("\") +imap 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 ? "" : "\(MUcompleteFwd)" +endf + +inoremap (TryUlti) =TryUltiSnips() +imap (TryMU) TryMUcomplete() +imap "\(TryUlti)\(TryMU)" packadd vim-mucomplete -- cgit v1.2.3