Files
nvim/plugins/blink.cmp.lua
T

90 lines
2.6 KiB
Lua

local blink = require("blink.cmp")
blink.setup({
completion = {
documentation = {
auto_show = true,
auto_show_delay_ms = 0,
window = {
winhighlight = "",
},
},
ghost_text = {
enabled = true,
},
list = {
selection = {
preselect = false,
auto_insert = false,
},
},
menu = {
border = "none",
draw = {
align_to = "simple_label",
columns = {
{ "simple_label" },
{ "kind_icon" },
},
components = {
simple_label = {
width = { fill = true, max = 60 },
text = function(ctx)
return ctx.label
end,
highlight = function(ctx)
local highlights = {
{
0,
#ctx.label,
group = ctx.deprecated
and "BlinkCmpLabelDeprecated"
or "BlinkCmpLabel",
},
}
for _, idx in ipairs(ctx.label_matched_indices) do
table.insert(highlights, {
idx,
idx + 1,
group = "BlinkCmpLabelMatch",
})
end
return highlights
end,
},
},
},
},
},
fuzzy = {
implementation = "prefer_rust_with_warning",
},
signature = {
enabled = true,
window = {
winhighlight = "",
show_documentation = false,
},
},
sources = {
default = {
"lsp",
"path",
"snippets",
},
transform_items = function(_, items)
---@param item blink.cmp.CompletionItem
return vim.tbl_map(function(item)
item.kind_icon, item.kind_hl =
require("lsp.kind").get(item.kind)
return item
end, items)
end,
},
keymap = {
preset = "default",
["<CR>"] = { "accept", "fallback" },
},
})