mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-24 06:20:05 +08:00
Fix #762
This commit is contained in:
parent
40aa947f46
commit
e6df9f8f07
@ -65,20 +65,19 @@ endfunction
|
|||||||
|
|
||||||
|
|
||||||
function! SpaceVim#layers#autocomplete#config() abort
|
function! SpaceVim#layers#autocomplete#config() abort
|
||||||
if g:spacevim_autocomplete_method ==# 'ycm'
|
|
||||||
sunmap <S-TAB>
|
|
||||||
iunmap <S-TAB>
|
|
||||||
endif
|
|
||||||
let g:delimitMate_matchpairs = '[:],{:},<:>'
|
let g:delimitMate_matchpairs = '[:],{:},<:>'
|
||||||
inoremap <silent><expr> ( complete_parameter#pre_complete("()")
|
inoremap <silent><expr> ( complete_parameter#pre_complete("()")
|
||||||
"mapping
|
|
||||||
imap <silent><expr><TAB> SpaceVim#mapping#tab#i_tab()
|
|
||||||
imap <expr><S-TAB> pumvisible() ? "\<C-p>" : ""
|
|
||||||
imap <silent><expr><S-TAB> SpaceVim#mapping#shift_tab()
|
|
||||||
smap <expr><TAB> neosnippet#expandable_or_jumpable() ? "\<Plug>(neosnippet_expand_or_jump)" : (complete_parameter#jumpable(1) ? "\<plug>(complete_parameter#goto_next_parameter)" : "\<TAB>")
|
|
||||||
imap <silent><expr><CR> SpaceVim#mapping#enter#i_enter()
|
|
||||||
smap <expr><S-TAB> pumvisible() ? "\<C-p>" : ""
|
|
||||||
|
|
||||||
|
"mapping
|
||||||
|
imap <silent><expr><TAB> SpaceVim#mapping#tab()
|
||||||
|
imap <silent><expr><S-TAB> SpaceVim#mapping#shift_tab()
|
||||||
|
imap <silent><expr><CR> SpaceVim#mapping#enter()
|
||||||
|
smap <expr><TAB>
|
||||||
|
\ neosnippet#expandable_or_jumpable() ?
|
||||||
|
\ "\<Plug>(neosnippet_expand_or_jump)" :
|
||||||
|
\ (complete_parameter#jumpable(1) ?
|
||||||
|
\ "\<plug>(complete_parameter#goto_next_parameter)" :
|
||||||
|
\ "\<TAB>")
|
||||||
|
|
||||||
inoremap <expr> <Down> pumvisible() ? "\<C-n>" : "\<Down>"
|
inoremap <expr> <Down> pumvisible() ? "\<C-n>" : "\<Down>"
|
||||||
inoremap <expr> <Up> pumvisible() ? "\<C-p>" : "\<Up>"
|
inoremap <expr> <Up> pumvisible() ? "\<C-p>" : "\<Up>"
|
||||||
|
@ -80,46 +80,11 @@ function! SpaceVim#mapping#shift_tab() abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SpaceVim#mapping#tab() abort
|
function! SpaceVim#mapping#tab() abort
|
||||||
if getline('.')[col('.')-2] ==# '{'&& pumvisible()
|
return SpaceVim#mapping#tab#i_tab()
|
||||||
return "\<C-n>"
|
|
||||||
endif
|
|
||||||
if index(g:spacevim_plugin_groups, 'autocomplete') != -1
|
|
||||||
if neosnippet#expandable() && getline('.')[col('.')-2] ==# '(' && !pumvisible()
|
|
||||||
return "\<Plug>(neosnippet_expand)"
|
|
||||||
elseif neosnippet#jumpable()
|
|
||||||
\ && getline('.')[col('.')-2] ==# '(' && !pumvisible()
|
|
||||||
\ && !neosnippet#expandable()
|
|
||||||
return "\<plug>(neosnippet_jump)"
|
|
||||||
elseif neosnippet#expandable_or_jumpable() && getline('.')[col('.')-2] !=#'('
|
|
||||||
return "\<plug>(neosnippet_expand_or_jump)"
|
|
||||||
elseif pumvisible()
|
|
||||||
return "\<C-n>"
|
|
||||||
elseif complete_parameter#jumpable(1)
|
|
||||||
return "\<plug>(complete_parameter#goto_next_parameter)"
|
|
||||||
else
|
|
||||||
return "\<tab>"
|
|
||||||
endif
|
|
||||||
elseif pumvisible()
|
|
||||||
return "\<C-n>"
|
|
||||||
else
|
|
||||||
return "\<tab>"
|
|
||||||
endif
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SpaceVim#mapping#enter() abort
|
function! SpaceVim#mapping#enter() abort
|
||||||
if pumvisible()
|
return SpaceVim#mapping#enter#i_enter()
|
||||||
if getline('.')[col('.') - 2]==# '{'
|
|
||||||
return "\<Enter>"
|
|
||||||
elseif g:spacevim_autocomplete_method ==# 'neocomplete'||g:spacevim_autocomplete_method ==# 'deoplete'
|
|
||||||
return "\<C-y>"
|
|
||||||
else
|
|
||||||
return "\<esc>a"
|
|
||||||
endif
|
|
||||||
elseif getline('.')[col('.') - 2]==#'{'&&getline('.')[col('.')-1]==#'}'
|
|
||||||
return "\<Enter>\<esc>ko"
|
|
||||||
else
|
|
||||||
return "\<Enter>"
|
|
||||||
endif
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! SpaceVim#mapping#gd() abort
|
function! SpaceVim#mapping#gd() abort
|
||||||
|
@ -3,7 +3,6 @@ if g:spacevim_snippet_engine ==# 'neosnippet'
|
|||||||
if getline('.')[col('.')-2] ==# '{'&& pumvisible()
|
if getline('.')[col('.')-2] ==# '{'&& pumvisible()
|
||||||
return "\<C-n>"
|
return "\<C-n>"
|
||||||
endif
|
endif
|
||||||
if index(g:spacevim_plugin_groups, 'autocomplete') != -1
|
|
||||||
if neosnippet#expandable() && getline('.')[col('.')-2] ==# '(' && !pumvisible()
|
if neosnippet#expandable() && getline('.')[col('.')-2] ==# '(' && !pumvisible()
|
||||||
return "\<Plug>(neosnippet_expand)"
|
return "\<Plug>(neosnippet_expand)"
|
||||||
elseif neosnippet#jumpable()
|
elseif neosnippet#jumpable()
|
||||||
@ -14,20 +13,16 @@ if g:spacevim_snippet_engine ==# 'neosnippet'
|
|||||||
return "\<plug>(neosnippet_expand_or_jump)"
|
return "\<plug>(neosnippet_expand_or_jump)"
|
||||||
elseif pumvisible()
|
elseif pumvisible()
|
||||||
return "\<C-n>"
|
return "\<C-n>"
|
||||||
elseif complete_parameter#jumpable(1)
|
elseif complete_parameter#jumpable(1) && getline('.')[col('.')-2] !=# ')'
|
||||||
return "\<plug>(complete_parameter#goto_next_parameter)"
|
return "\<plug>(complete_parameter#goto_next_parameter)"
|
||||||
else
|
else
|
||||||
return "\<tab>"
|
return "\<tab>"
|
||||||
endif
|
endif
|
||||||
elseif pumvisible()
|
|
||||||
return "\<C-n>"
|
|
||||||
else
|
|
||||||
return "\<tab>"
|
|
||||||
endif
|
|
||||||
endfunction
|
endfunction
|
||||||
elseif g:spacevim_snippet_engine ==# 'ultisnips'
|
elseif g:spacevim_snippet_engine ==# 'ultisnips'
|
||||||
function! SpaceVim#mapping#tab#i_tab() abort
|
function! SpaceVim#mapping#tab#i_tab() abort
|
||||||
return "\<tab>"
|
return "\<tab>"
|
||||||
endfunction
|
endfunction
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" vim:set et sw=2 cc=80:
|
" vim:set et sw=2 cc=80:
|
||||||
|
Loading…
Reference in New Issue
Block a user