mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-24 10:47:07 +08:00
36 lines
1.2 KiB
VimL
36 lines
1.2 KiB
VimL
"=============================================================================
|
|
" enter.vim --- Enter key bindings
|
|
" Copyright (c) 2016-2023 Wang Shidong & Contributors
|
|
" Author: Wang Shidong < wsdjeg@outlook.com >
|
|
" URL: https://spacevim.org
|
|
" License: GPLv3
|
|
"=============================================================================
|
|
if g:spacevim_snippet_engine ==# 'neosnippet'
|
|
function! SpaceVim#mapping#enter#i_enter() abort
|
|
if pumvisible()
|
|
if neosnippet#expandable()
|
|
return "\<plug>(neosnippet_expand)"
|
|
else
|
|
return "\<c-y>"
|
|
endif
|
|
elseif getline('.')[col('.') - 2]==#'{'&&getline('.')[col('.')-1]==#'}'
|
|
return "\<Enter>\<esc>ko"
|
|
elseif getline('.')[col('.') - 2]==#'('&&getline('.')[col('.')-1]==#')'
|
|
return "\<Enter>\<esc>ko"
|
|
else
|
|
return "\<Enter>"
|
|
endif
|
|
endfunction
|
|
elseif g:spacevim_snippet_engine ==# 'ultisnips'
|
|
function! SpaceVim#mapping#enter#i_enter() abort
|
|
if pumvisible()
|
|
return "\<c-y>"
|
|
elseif getline('.')[col('.') - 2]==#'{'&&getline('.')[col('.')-1]==#'}'
|
|
return "\<Enter>\<esc>ko"
|
|
else
|
|
return "\<Enter>"
|
|
endif
|
|
endfunction
|
|
endif
|
|
" vim:set et sw=2 cc=80:
|