mirror of
https://github.com/boxpositron/absolute-vim.git
synced 2026-02-28 11:40:36 +00:00
feat(nvim-cmp.lua): change mapping confirm behavior to select current suggestion by default
This commit is contained in:
@@ -6,31 +6,31 @@ local lspkind = require("lspkind")
|
|||||||
require("luasnip.loaders.from_vscode").lazy_load()
|
require("luasnip.loaders.from_vscode").lazy_load()
|
||||||
|
|
||||||
cmp.setup({
|
cmp.setup({
|
||||||
completion = {
|
completion = {
|
||||||
completeopt = "menu,menuone,preview,noselect",
|
completeopt = "menu,menuone,preview,noselect",
|
||||||
},
|
},
|
||||||
snippet = { -- configure how nvim-cmp interacts with snippet engine
|
snippet = { -- configure how nvim-cmp interacts with snippet engine
|
||||||
expand = function(args)
|
expand = function(args)
|
||||||
luasnip.lsp_expand(args.body)
|
luasnip.lsp_expand(args.body)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
mapping = cmp.mapping.preset.insert({
|
mapping = cmp.mapping.preset.insert({
|
||||||
["<C-Space>"] = cmp.mapping.complete(), -- show completion suggestions
|
["<C-Space>"] = cmp.mapping.complete(), -- show completion suggestions
|
||||||
["<CR>"] = cmp.mapping.confirm({ select = false }), -- accept current selection
|
["<CR>"] = cmp.mapping.confirm({ select = true }), -- accept current selection
|
||||||
}),
|
}),
|
||||||
-- sources for autocompletion
|
-- sources for autocompletion
|
||||||
sources = cmp.config.sources({
|
sources = cmp.config.sources({
|
||||||
{ name = "otter" }, -- custom source for otter completion
|
{ name = "otter" }, -- custom source for otter completion
|
||||||
{ name = "nvim_lsp" },
|
{ name = "nvim_lsp" },
|
||||||
{ name = "luasnip" }, -- snippets
|
{ name = "luasnip" }, -- snippets
|
||||||
{ name = "buffer" }, -- text within current buffer
|
{ name = "buffer" }, -- text within current buffer
|
||||||
{ name = "path" }, -- file system paths
|
{ name = "path" }, -- file system paths
|
||||||
}),
|
}),
|
||||||
-- configure lspkind for vs-code like pictograms in completion menu
|
-- configure lspkind for vs-code like pictograms in completion menu
|
||||||
formatting = {
|
formatting = {
|
||||||
format = lspkind.cmp_format({
|
format = lspkind.cmp_format({
|
||||||
maxwidth = 50,
|
maxwidth = 50,
|
||||||
ellipsis_char = "...",
|
ellipsis_char = "...",
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user