mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 13:10:04 +08:00
Add tab.vim
This commit is contained in:
parent
1c5b839e73
commit
3466ae9dc1
@ -158,7 +158,7 @@ endfunction
|
|||||||
function! SpaceVim#default#SetMappings() abort
|
function! SpaceVim#default#SetMappings() abort
|
||||||
|
|
||||||
"mapping
|
"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 <expr><S-TAB> pumvisible() ? "\<C-p>" : ""
|
||||||
imap <silent><expr><S-TAB> SpaceVim#mapping#shift_tab()
|
imap <silent><expr><S-TAB> SpaceVim#mapping#shift_tab()
|
||||||
smap <expr><TAB> neosnippet#expandable_or_jumpable() ? "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
|
smap <expr><TAB> neosnippet#expandable_or_jumpable() ? "\<Plug>(neosnippet_expand_or_jump)" : "\<TAB>"
|
||||||
|
32
autoload/SpaceVim/mapping/tab.vim
Normal file
32
autoload/SpaceVim/mapping/tab.vim
Normal 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:
|
@ -22,7 +22,7 @@ if g:neosnippet#enable_complete_done
|
|||||||
endif
|
endif
|
||||||
augroup neosnippet_complete_done
|
augroup neosnippet_complete_done
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd CompleteDone * call s:my_complete_done()
|
"autocmd CompleteDone * call s:my_complete_done()
|
||||||
augroup END
|
augroup END
|
||||||
function! s:my_complete_done() abort "{{{
|
function! s:my_complete_done() abort "{{{
|
||||||
if !empty(get(v:,'completed_item',''))
|
if !empty(get(v:,'completed_item',''))
|
||||||
|
Loading…
Reference in New Issue
Block a user