mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 13:10:04 +08:00
Fix ycm mappings
This commit is contained in:
parent
d3931cd673
commit
54ec968bc9
@ -110,6 +110,7 @@ function! SpaceVim#layers#autocomplete#config() abort
|
||||
if s:tab_key_behavior ==# 'smart'
|
||||
if has('patch-7.4.774')
|
||||
imap <silent><expr><TAB> SpaceVim#mapping#tab()
|
||||
if g:spacevim_snippet_engine ==# 'neosnippet'
|
||||
smap <expr><TAB>
|
||||
\ neosnippet#expandable_or_jumpable() ?
|
||||
\ "\<Plug>(neosnippet_expand_or_jump)" :
|
||||
@ -117,6 +118,11 @@ function! SpaceVim#layers#autocomplete#config() abort
|
||||
\ "\<plug>(complete_parameter#goto_next_parameter)" :
|
||||
\ "\<TAB>")
|
||||
imap <silent><expr><S-TAB> SpaceVim#mapping#shift_tab()
|
||||
elseif g:spacevim_snippet_engine ==# 'ultisnips'
|
||||
imap <silent><expr><TAB> SpaceVim#mapping#tab()
|
||||
imap <silent><expr><S-TAB> SpaceVim#mapping#shift_tab()
|
||||
else
|
||||
endif
|
||||
else
|
||||
call SpaceVim#logger#warn('smart tab in autocomplete layer need patch 7.4.774')
|
||||
endif
|
||||
|
@ -79,9 +79,15 @@ function! SpaceVim#mapping#def(type, key, value, ...) abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#mapping#shift_tab() abort
|
||||
if g:spacevim_snippet_engine ==# 'neosnippet'
|
||||
function! SpaceVim#mapping#shift_tab() abort
|
||||
return pumvisible() ? "\<C-p>" : "\<Plug>delimitMateS-Tab"
|
||||
endfunction
|
||||
endfunction
|
||||
elseif g:spacevim_snippet_engine ==# 'ultisnips'
|
||||
function! SpaceVim#mapping#shift_tab() abort
|
||||
return pumvisible() ? "\<C-p>" : "\<C-R>=UltiSnips#JumpForwards()\<CR>\<C-R>=cmp#ultisnips#JumpForward()\<CR>"
|
||||
endfunction
|
||||
endif
|
||||
|
||||
function! SpaceVim#mapping#tab() abort
|
||||
return SpaceVim#mapping#tab#i_tab()
|
||||
|
@ -20,9 +20,23 @@ if g:spacevim_snippet_engine ==# 'neosnippet'
|
||||
endif
|
||||
endfunction
|
||||
elseif g:spacevim_snippet_engine ==# 'ultisnips'
|
||||
function! SpaceVim#mapping#tab#expandable()
|
||||
let snippet = UltiSnips#ExpandSnippetOrJump()
|
||||
if g:ulti_expand_or_jump_res > 0
|
||||
return snippet
|
||||
elseif pumvisible()
|
||||
return "\<C-n>"
|
||||
else
|
||||
return "\<TAB>"
|
||||
endif
|
||||
endfunction
|
||||
function! SpaceVim#mapping#tab#i_tab() abort
|
||||
return "\<tab>"
|
||||
if getline('.')[col('.')-2] ==# '{'&& pumvisible()
|
||||
return "\<C-n>"
|
||||
endif
|
||||
return "\<C-R>=SpaceVim#mapping#tab#expandable()\<cr>"
|
||||
endfunction
|
||||
endif
|
||||
|
||||
|
||||
" vim:set et sw=2 cc=80:
|
||||
|
@ -1,6 +1,6 @@
|
||||
" If you want :UltiSnipsEdit to split your window.
|
||||
let g:UltiSnipsEditSplit="vertical"
|
||||
let g:UltiSnipsExpandTrigger='<tab>'
|
||||
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
|
||||
let g:UltiSnipsJumpForwardTrigger='<tab>'
|
||||
let g:UltiSnipsExpandTrigger='<Nop>'
|
||||
let g:UltiSnipsJumpBackwardTrigger='<Nop>'
|
||||
let g:UltiSnipsJumpForwardTrigger='<Nop>'
|
||||
let g:UltiSnipsSnippetsDir = '~/.SpaceVim.d/UltiSnips'
|
||||
|
Loading…
Reference in New Issue
Block a user