mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-23 01:09:56 +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 s:tab_key_behavior ==# 'smart'
|
||||||
if has('patch-7.4.774')
|
if has('patch-7.4.774')
|
||||||
imap <silent><expr><TAB> SpaceVim#mapping#tab()
|
imap <silent><expr><TAB> SpaceVim#mapping#tab()
|
||||||
|
if g:spacevim_snippet_engine ==# 'neosnippet'
|
||||||
smap <expr><TAB>
|
smap <expr><TAB>
|
||||||
\ neosnippet#expandable_or_jumpable() ?
|
\ neosnippet#expandable_or_jumpable() ?
|
||||||
\ "\<Plug>(neosnippet_expand_or_jump)" :
|
\ "\<Plug>(neosnippet_expand_or_jump)" :
|
||||||
@ -117,6 +118,11 @@ function! SpaceVim#layers#autocomplete#config() abort
|
|||||||
\ "\<plug>(complete_parameter#goto_next_parameter)" :
|
\ "\<plug>(complete_parameter#goto_next_parameter)" :
|
||||||
\ "\<TAB>")
|
\ "\<TAB>")
|
||||||
imap <silent><expr><S-TAB> SpaceVim#mapping#shift_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
|
else
|
||||||
call SpaceVim#logger#warn('smart tab in autocomplete layer need patch 7.4.774')
|
call SpaceVim#logger#warn('smart tab in autocomplete layer need patch 7.4.774')
|
||||||
endif
|
endif
|
||||||
|
@ -79,9 +79,15 @@ function! SpaceVim#mapping#def(type, key, value, ...) abort
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
if g:spacevim_snippet_engine ==# 'neosnippet'
|
||||||
function! SpaceVim#mapping#shift_tab() abort
|
function! SpaceVim#mapping#shift_tab() abort
|
||||||
return pumvisible() ? "\<C-p>" : "\<Plug>delimitMateS-Tab"
|
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
|
function! SpaceVim#mapping#tab() abort
|
||||||
return SpaceVim#mapping#tab#i_tab()
|
return SpaceVim#mapping#tab#i_tab()
|
||||||
|
@ -20,9 +20,23 @@ if g:spacevim_snippet_engine ==# 'neosnippet'
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
elseif g:spacevim_snippet_engine ==# 'ultisnips'
|
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
|
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
|
endfunction
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
" vim:set et sw=2 cc=80:
|
" vim:set et sw=2 cc=80:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
" If you want :UltiSnipsEdit to split your window.
|
" If you want :UltiSnipsEdit to split your window.
|
||||||
let g:UltiSnipsEditSplit="vertical"
|
let g:UltiSnipsEditSplit="vertical"
|
||||||
let g:UltiSnipsExpandTrigger='<tab>'
|
let g:UltiSnipsExpandTrigger='<Nop>'
|
||||||
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
|
let g:UltiSnipsJumpBackwardTrigger='<Nop>'
|
||||||
let g:UltiSnipsJumpForwardTrigger='<tab>'
|
let g:UltiSnipsJumpForwardTrigger='<Nop>'
|
||||||
let g:UltiSnipsSnippetsDir = '~/.SpaceVim.d/UltiSnips'
|
let g:UltiSnipsSnippetsDir = '~/.SpaceVim.d/UltiSnips'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user