init.lua/after/plugin/cmp.lua

38 lines
825 B
Lua
Raw Normal View History

2024-02-11 18:34:46 +05:30
require("cmp_git").setup()
2024-02-11 17:31:06 +05:30
local cmp = require("cmp")
cmp.setup({
2024-02-11 22:46:18 +05:30
mapping = {
["<C-k>"] = cmp.mapping.select_prev_item(),
["<C-j>"] = cmp.mapping.select_next_item(),
["<C-space>"] = cmp.mapping.complete(),
["<C-q>"] = cmp.mapping.close(),
["<Tab>"] = cmp.mapping.confirm({ select = true }),
},
2024-02-11 17:31:06 +05:30
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "nvim_lsp_signature_help" },
{ name = "luasnip" },
2024-02-11 18:34:46 +05:30
}, {
{ name = "buffer" },
2024-02-11 17:31:06 +05:30
}),
formatting = {
format = require("lspkind").cmp_format({
mode = "symbol_text",
}),
},
})
2024-02-11 18:34:46 +05:30
cmp.setup.filetype("gitcommit", {
sources = cmp.config.sources({
{ name = "git" },
}, {
{ name = "buffer" },
}),
})