nvim1/lua/plugins/blink.lua

98 lines
2.0 KiB
Lua

local not_enabled_filetype = { "markdown" }
---@module 'blink.cmp'
---@type blink.cmp.Config
local opts = {
cmdline = { enabled = true },
keymap = { preset = "super-tab" },
completion = {
documentation = {
auto_show = true,
treesitter_highlighting = true,
},
keyword = {
range = "prefix",
},
list = {
selection = {
preselect = true,
auto_insert = false,
},
},
accept = {
dot_repeat = false,
create_undo_point = true,
auto_brackets = { enabled = true },
},
menu = {
draw = {
columns = { { "label", "label_detail", gap = 1 }, { "kind_icon", "kind", gap = 1 } },
components = {
label = {
width = { max = 30, fill = true },
text = function(ctx)
return ctx.label
end,
},
label_detail = {
width = { fill = true, max = 15 },
text = function(ctx)
return ctx.label_detail
end,
},
source_name = {},
},
},
},
},
appearance = {
nerd_font_variant = "mono",
},
sources = {
default = { "lsp", "path", "snippets", "buffer" },
providers = {
buffer = {
enabled = true,
},
snippets = {
enabled = false,
},
},
},
fuzzy = {
implementation = "rust",
use_frecency = false,
use_proximity = false,
max_typos = function(_)
return 0
end,
prebuilt_binaries = {
download = false,
ignore_version_mismatch = true,
},
},
signature = { enabled = true },
}
local setup = function(_, opts)
return opts
end
return {
"saghen/blink.cmp",
opts_extend = { "sources.completion.enabled_providers", "sources.compat", "sources.default" },
dependencies = {
"rafamadriz/friendly-snippets",
{ "saghen/blink.compat", optional = true, opts = {}, version = not vim.g.lazyvim_blink_main and "*" },
},
event = "InsertEnter",
version = "*",
enabled = function()
return not vim.tbl_contains(not_enabled_filetype, vim.bo.filetype)
and vim.bo.buftype ~= "prompt"
and vim.b.completion ~= false
end,
opts = opts,
config = setup,
}