Updated config
This commit is contained in:
@ -45,55 +45,55 @@ return {
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
-- "hrsh7th/cmp-nvim-lsp",
|
||||
-- "hrsh7th/cmp-buffer",
|
||||
-- "hrsh7th/cmp-path",
|
||||
-- "L3MON4D3/LuaSnip",
|
||||
},
|
||||
config = function()
|
||||
opts = {
|
||||
completion = {
|
||||
autocomplete = true,
|
||||
completeopt = "menu,menuone,noinsert",
|
||||
},
|
||||
formatting = {
|
||||
fields = { "abbr", "kind", "menu" },
|
||||
format = function(_, item)
|
||||
local icon = icons[item.kind] or ""
|
||||
item.kind = string.format(" %s %s", icon, item.kind)
|
||||
return item
|
||||
end,
|
||||
},
|
||||
-- snippet = {
|
||||
-- expand = function(args)
|
||||
-- require("luasnip").lsp_expand(args.body)
|
||||
-- end,
|
||||
-- },
|
||||
-- preselect = cmp.PreselectMode.None,
|
||||
sources = {
|
||||
-- { name = "nvim_lsp" },
|
||||
-- { name = "luasnip" },
|
||||
{ name = "buffer" },
|
||||
-- { name = "path" },
|
||||
},
|
||||
window = {
|
||||
completion = {
|
||||
border = "rounded",
|
||||
scrollbar = false,
|
||||
},
|
||||
documentation = {
|
||||
border = "rounded",
|
||||
}
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
local cmp = require("cmp")
|
||||
|
||||
local opts = {
|
||||
completion = {
|
||||
-- autocomplete = false,
|
||||
completeopt = "menu,menuone,noinsert",
|
||||
},
|
||||
formatting = {
|
||||
fields = { "abbr", "kind", "menu" },
|
||||
format = function(_, item)
|
||||
local icon = icons[item.kind] or ""
|
||||
item.kind = string.format(" %s %s", icon, item.kind)
|
||||
return item
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
["<C-space>"] = cmp.mapping.complete(),
|
||||
["<C-up>"] = cmp.mapping.select_prev_item(),
|
||||
["<C-down>"] = cmp.mapping.select_next_item(),
|
||||
["<C-x>"] = cmp.mapping.abort(),
|
||||
["<cr>"] = cmp.mapping.confirm({ select = true }),
|
||||
},
|
||||
-- snippet = {
|
||||
-- expand = function(args)
|
||||
-- require("luasnip").lsp_expand(args.body)
|
||||
-- end,
|
||||
-- },
|
||||
-- preselect = cmp.PreselectMode.None,
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
-- { name = "luasnip" },
|
||||
-- { name = "buffer" },
|
||||
-- { name = "path" },
|
||||
},
|
||||
window = {
|
||||
completion = {
|
||||
border = "rounded",
|
||||
scrollbar = false,
|
||||
},
|
||||
documentation = {
|
||||
border = "rounded",
|
||||
}
|
||||
},
|
||||
opts.mapping = {
|
||||
["<C-space>"] = cmp.mapping.complete(),
|
||||
["<C-up>"] = cmp.mapping.select_prev_item(),
|
||||
["<C-down>"] = cmp.mapping.select_next_item(),
|
||||
["<C-x>"] = cmp.mapping.abort(),
|
||||
["<cr>"] = cmp.mapping.confirm({ select = true }),
|
||||
}
|
||||
|
||||
cmp.setup(opts)
|
||||
|
Reference in New Issue
Block a user