127 lines
3.5 KiB
Lua
127 lines
3.5 KiB
Lua
return { "Saghen/blink.cmp",
|
|
branch = "v1.*",
|
|
reqs = {
|
|
"xzbdmw/colorful-menu.nvim",
|
|
"L3MON4D3/LuaSnip"
|
|
},
|
|
lazy = dep_short.auto("InsertEnter"),
|
|
load = function()
|
|
local colormenu = require("colorful-menu")
|
|
require("blink.cmp").setup {
|
|
keymap = {
|
|
preset = "none", -- I don't like the default documentation scroll binds
|
|
["<C-y>"] = { "select_and_accept" },
|
|
["<C-n>"] = { "select_next", "fallback_to_mappings" },
|
|
["<C-p>"] = { "select_prev", "fallback_to_mappings" },
|
|
|
|
["<C-u>"] = { "scroll_documentation_up", "fallback" },
|
|
["<C-d>"] = { "scroll_documentation_down", "fallback" }
|
|
},
|
|
|
|
completion = {
|
|
menu = {
|
|
scrollbar = false,
|
|
border = vim.g.border_style,
|
|
draw = {
|
|
columns = {
|
|
{ "kind_icon" },
|
|
{ "label", "label_description", gap = 1 },
|
|
{ "kind" }
|
|
},
|
|
|
|
-- blink.cmp should not take this much damn work to make it look
|
|
-- semi-decent
|
|
components = {
|
|
-- we replace the kind icon with the an icon for the source
|
|
kind_icon = {
|
|
text = function(ctx)
|
|
local menu_icon = {
|
|
"?", -- fallback
|
|
lsp = "λ",
|
|
snippets = "%",
|
|
buffer = "@",
|
|
path = "#",
|
|
cmdline = "$"
|
|
}
|
|
|
|
local icon = menu_icon[ctx.source_id]
|
|
if icon == nil then
|
|
icon = menu_icon[1]
|
|
end
|
|
|
|
return icon
|
|
end,
|
|
highlight = function(_)
|
|
return { { group = "CmpItemMenu" } }
|
|
end
|
|
},
|
|
label = {
|
|
text = function(ctx)
|
|
return colormenu.blink_components_text(ctx)
|
|
end,
|
|
highlight = function(ctx)
|
|
return colormenu.blink_components_highlight(ctx)
|
|
end
|
|
},
|
|
kind = {
|
|
-- these highlights are technically for nvim-cmp, but they're
|
|
-- built into my colorscheme so I don"t mind using them here
|
|
highlight = function(ctx)
|
|
return {
|
|
{ group = "CmpItemKind"..ctx.kind, priority = 20000 }
|
|
}
|
|
end
|
|
}
|
|
}
|
|
}
|
|
},
|
|
|
|
ghost_text = {
|
|
enabled = true
|
|
},
|
|
|
|
-- documentation should show up immediately
|
|
documentation = {
|
|
auto_show = true,
|
|
auto_show_delay_ms = 0,
|
|
window = {
|
|
border = vim.g.border_style
|
|
}
|
|
}
|
|
},
|
|
|
|
-- I like the default command line completion
|
|
cmdline = {
|
|
enabled = false
|
|
},
|
|
|
|
-- signature support is necessary
|
|
signature = {
|
|
enabled = true,
|
|
window = {
|
|
border = vim.g.border_style
|
|
}
|
|
},
|
|
|
|
-- TODO: find a way to make my fancy luasnip snippets with multiple
|
|
-- triggers not look stupid e.g. "fn\|main" for a function that could
|
|
-- be triggered by fn or main
|
|
snippets = {
|
|
preset = "luasnip"
|
|
},
|
|
|
|
sources = {
|
|
default = { "lsp", "path", "snippets", "buffer" }
|
|
},
|
|
|
|
fuzzy = {
|
|
implementation = "prefer_rust_with_warning",
|
|
sorts = {
|
|
"score",
|
|
"sort_text"
|
|
}
|
|
}
|
|
}
|
|
end
|
|
}
|