chore(nvim): use tab, s-tab to cmp

main
sudo pacman -Syu 2023-07-13 21:49:04 +07:00
parent ec2e365b78
commit e22234acde
1 changed files with 21 additions and 1 deletions

View File

@ -191,7 +191,27 @@ require("lazy").setup({
},
mapping = cmp.mapping.preset.insert({
["<C-Space>"] = cmp.mapping.complete(),
["<CR>"] = cmp.mapping.confirm(),
["<CR>"] = function(fallback)
if cmp.visible() then
cmp.confirm()
else
fallback()
end
end,
["<Tab>"] = function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end,
["<S-Tab>"] = function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end,
}),
sources = cmp.config.sources({
{ name = "nvim_lsp" },