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

Compare commits

...

2 Commits

Author SHA1 Message Date
Eric Wong
2e6031b927 fix(telescope): remove on_cmd option 2024-12-07 20:53:17 +08:00
Eric Wong
c2c8a96161 fix(cmp): fix nvim-cmp mapping
close https://github.com/SpaceVim/SpaceVim/issues/4929
2024-12-07 18:53:28 +08:00
3 changed files with 12 additions and 4 deletions

View File

@ -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()

View File

@ -50,11 +50,11 @@ endfunction
function! SpaceVim#layers#telescope#plugins() abort function! SpaceVim#layers#telescope#plugins() abort
let plugins = [] let plugins = []
if has('nvim-0.10.0') if has('nvim-0.10.0')
call add(plugins, [g:_spacevim_root_dir . 'bundle/telescope.nvim-0.1.8', {'merged' : 0, 'loadconf' : 1, 'on_cmd' : ['Telescope']}]) call add(plugins, [g:_spacevim_root_dir . 'bundle/telescope.nvim-0.1.8', {'merged' : 0, 'loadconf' : 1}])
elseif has('nvim-0.7.2') elseif has('nvim-0.7.2')
call add(plugins, [g:_spacevim_root_dir . 'bundle/telescope.nvim-0.1.5', {'merged' : 0, 'loadconf' : 1, 'on_cmd' : ['Telescope']}]) call add(plugins, [g:_spacevim_root_dir . 'bundle/telescope.nvim-0.1.5', {'merged' : 0, 'loadconf' : 1}])
elseif has('nvim-0.7.0') elseif has('nvim-0.7.0')
call add(plugins, [g:_spacevim_root_dir . 'bundle/telescope.nvim-0.1.2', {'merged' : 0, 'loadconf' : 1, 'on_cmd' : ['Telescope']}]) call add(plugins, [g:_spacevim_root_dir . 'bundle/telescope.nvim-0.1.2', {'merged' : 0, 'loadconf' : 1}])
endif endif
call add(plugins, [g:_spacevim_root_dir . 'bundle/plenary.nvim', {'merged' : 0}]) call add(plugins, [g:_spacevim_root_dir . 'bundle/plenary.nvim', {'merged' : 0}])
call add(plugins, [g:_spacevim_root_dir . 'bundle/telescope-menu', {'merged' : 0}]) call add(plugins, [g:_spacevim_root_dir . 'bundle/telescope-menu', {'merged' : 0}])

View File

@ -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
if cmp.visible() then
cmp.mapping.confirm({ select = false }) 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