nix/homes/modules/programs/neovim/lua/lsp/completion.lua

103 lines
2.1 KiB
Lua

return {
{
"friendly-snippets",
dep_of = { "blink.cmp" },
},
{
"blink.cmp",
event = { "InsertEnter", "CmdlineEnter" },
on_require = "blink",
load = function(name)
vim.cmd.packadd(name)
end,
after = function(plugin)
local blink = require("blink.cmp")
blink.setup({
keymap = {
["<C-space>"] = { "show", "show_documentation", "hide_documentation" },
["<C-e>"] = { "hide", "fallback" },
["<C-y>"] = { "select_and_accept", "fallback" },
["<C-k>"] = { "select_prev", "fallback_to_mappings" },
["<C-j>"] = { "select_next", "fallback_to_mappings" },
["<Up>"] = { "select_prev", "fallback" },
["<Down>"] = { "select_next", "fallback" },
["<C-b>"] = { "scroll_documentation_up", "fallback" },
["<C-f>"] = { "scroll_documentation_down", "fallback" },
["<Tab>"] = { "snippet_forward", "fallback" },
["<S-Tab>"] = { "snippet_backward", "fallback" },
["<C-S-k>"] = { "show_signature", "hide_signature", "fallback" },
},
appearance = {
nerd_font_variant = "mono",
},
sources = {
default = { "lsp", "path", "snippets", "buffer" },
providers = {
lsp = {
name = "LSP",
module = "blink.cmp.sources.lsp",
enabled = true,
},
path = {
name = "Path",
module = "blink.cmp.sources.path",
enabled = true,
},
snippets = {
name = "Snippets",
module = "blink.cmp.sources.snippets",
enabled = true,
},
buffer = {
name = "Buffer",
module = "blink.cmp.sources.buffer",
enabled = true,
},
},
},
completion = {
accept = {
auto_brackets = {
enabled = true,
},
},
menu = {
border = "rounded",
max_height = 12,
scrolloff = 2,
draw = {
columns = {
{ "kind_icon", gap = 1 },
{ "label", "label_description", gap = 1 },
},
},
},
documentation = {
auto_show = false,
window = {
border = "rounded",
},
},
},
signature = {
enabled = true,
window = {
border = "rounded",
},
},
})
end,
},
}