mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-02-02 23:50:04 +08:00
fix(cmp): fix nvim-cmp mapping
close https://github.com/SpaceVim/SpaceVim/issues/4929
This commit is contained in:
parent
abbedafcc8
commit
c2c8a96161
@ -322,6 +322,9 @@ function! SpaceVim#layers#autocomplete#config() abort
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
"mapping
|
"mapping
|
||||||
|
"
|
||||||
|
" 如果使用 nvim-cmp 作为补全引擎,那么 Tab 以及 Enter 快捷键的映射是在
|
||||||
|
" ./lua/config/nvim-cmp.lua 内设置。
|
||||||
if s:tab_key_behavior ==# 'smart'
|
if s:tab_key_behavior ==# 'smart'
|
||||||
if has('patch-7.4.774')
|
if has('patch-7.4.774')
|
||||||
imap <silent><expr><TAB> SpaceVim#mapping#tab()
|
imap <silent><expr><TAB> SpaceVim#mapping#tab()
|
||||||
|
@ -43,7 +43,12 @@ end
|
|||||||
|
|
||||||
local function enter(f) -- {{{
|
local function enter(f) -- {{{
|
||||||
if copt.auto_completion_return_key_behavior == 'complete' then
|
if copt.auto_completion_return_key_behavior == 'complete' then
|
||||||
cmp.mapping.confirm({ select = false })
|
if cmp.visible() then
|
||||||
|
cmp.mapping.confirm({ select = false })
|
||||||
|
return cmp.close()
|
||||||
|
else
|
||||||
|
pcall(f)
|
||||||
|
end
|
||||||
elseif copt.auto_completion_return_key_behavior == 'smart' then
|
elseif copt.auto_completion_return_key_behavior == 'smart' then
|
||||||
expand_snippet(nil)
|
expand_snippet(nil)
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
|
Loading…
Reference in New Issue
Block a user