1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 22:40:04 +08:00
This commit is contained in:
wsdjeg 2017-08-01 06:51:11 +08:00
parent 40aa947f46
commit e6df9f8f07
3 changed files with 24 additions and 65 deletions

View File

@ -65,21 +65,20 @@ endfunction
function! SpaceVim#layers#autocomplete#config() abort
if g:spacevim_autocomplete_method ==# 'ycm'
sunmap <S-TAB>
iunmap <S-TAB>
endif
let g:delimitMate_matchpairs = '[:],{:},<:>'
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> <Up> pumvisible() ? "\<C-p>" : "\<Up>"
inoremap <expr> <PageDown> pumvisible() ? "\<PageDown>\<C-p>\<C-n>" : "\<PageDown>"

View File

@ -80,46 +80,11 @@ function! SpaceVim#mapping#shift_tab() abort
endfunction
function! SpaceVim#mapping#tab() abort
if getline('.')[col('.')-2] ==# '{'&& pumvisible()
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
return SpaceVim#mapping#tab#i_tab()
endfunction
function! SpaceVim#mapping#enter() abort
if pumvisible()
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
return SpaceVim#mapping#enter#i_enter()
endfunction
function! SpaceVim#mapping#gd() abort

View File

@ -3,24 +3,18 @@ if g:spacevim_snippet_engine ==# 'neosnippet'
if getline('.')[col('.')-2] ==# '{'&& pumvisible()
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
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) && getline('.')[col('.')-2] !=# ')'
return "\<plug>(complete_parameter#goto_next_parameter)"
else
return "\<tab>"
endif
@ -30,4 +24,5 @@ elseif g:spacevim_snippet_engine ==# 'ultisnips'
return "\<tab>"
endfunction
endif
" vim:set et sw=2 cc=80: