1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 10:30:05 +08:00

Add tab.vim

This commit is contained in:
wsdjeg 2017-04-02 20:49:09 +08:00
parent 1c5b839e73
commit 3466ae9dc1
3 changed files with 34 additions and 2 deletions

View File

@ -158,7 +158,7 @@ endfunction
function! SpaceVim#default#SetMappings() abort
"mapping
imap <silent><expr><TAB> SpaceVim#mapping#tab()
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)" : "\<TAB>"

View File

@ -0,0 +1,32 @@
if g:spacevim_snippet_engine ==# 'neosnippet'
function! SpaceVim#mapping#tab#i_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] !=#'('
let g:wsd = 1
return "\<plug>(neosnippet_expand_or_jump)"
elseif pumvisible()
return "\<C-n>"
else
return "\<tab>"
endif
elseif pumvisible()
return "\<C-n>"
else
return "\<tab>"
endif
endfunction
elseif g:spacevim_snippet_engine ==# 'ultisnips'
function! SpaceVim#mapping#tab#i_tab() abort
return "\<tab>"
endfunction
endif
" vim:set et sw=2 cc=80:

View File

@ -22,7 +22,7 @@ if g:neosnippet#enable_complete_done
endif
augroup neosnippet_complete_done
autocmd!
autocmd CompleteDone * call s:my_complete_done()
"autocmd CompleteDone * call s:my_complete_done()
augroup END
function! s:my_complete_done() abort "{{{
if !empty(get(v:,'completed_item',''))