neovim-dotfiles/lua/plugins/nvim-cmp.lua
2025-04-30 20:08:59 +02:00

59 lines
1.3 KiB
Lua

return {
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-path",
"hrsh7th/cmp-cmdline",
"hrsh7th/cmp-nvim-lua",
"neovim/nvim-lspconfig",
"mtoohey31/cmp-fish",
"petertriho/cmp-git",
},
config = function()
local cmp = require("cmp")
cmp.setup({
sources = {
{ name = "nvim_lua" },
{
name = "nvim_lsp",
entry_filter = function(entry, ctx)
local kind = require("cmp.types").lsp.CompletionItemKind[entry:get_kind()]
if kind == "Text" then
return false
end
return true
end,
},
{ name = "neorg" },
{ name = "fish" },
},
snippet = {
expand = function(args)
-- You need Neovim v0.10 to use vim.snippet
vim.snippet.expand(args.body)
end,
},
cmp.setup.filetype("gitcommit", {
sources = cmp.config.sources({
{ name = "git" },
}, {
{ name = "buffer" },
}),
}),
require("cmp_git").setup(),
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
mapping = cmp.mapping.preset.insert({
["<C-Space>"] = cmp.mapping.complete(),
["<S-NL>"] = cmp.mapping.scroll_docs(-4),
["<C-S-K>"] = cmp.mapping.scroll_docs(-4),
[" "] = cmp.mapping.confirm(),
}),
})
end,
}