local M = {}
|
|
|
|
M.install = { src = "https://github.com/saghen/blink.cmp" }
|
|
|
|
M.dependencies = {
|
|
{ src = "https://github.com/rafamadriz/friendly-snippets" },
|
|
}
|
|
|
|
M.setup = function()
|
|
require("blink.cmp").setup({
|
|
completion = {
|
|
accept = {
|
|
auto_brackets = {
|
|
enabled = true,
|
|
},
|
|
},
|
|
menu = {
|
|
auto_show = true,
|
|
winblend = vim.o.pumblend,
|
|
scrollbar = true,
|
|
border = 'rounded',
|
|
winhighlight = 'Normal:NormalFloat,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None',
|
|
draw = {
|
|
padding = 1,
|
|
gap = 1,
|
|
columns = {
|
|
{ "kind_icon" },
|
|
{ "label", "label_description", gap = 1 },
|
|
{ "kind" }
|
|
},
|
|
components = {
|
|
kind_icon = {
|
|
ellipsis = false,
|
|
text = function(ctx)
|
|
return ctx.kind_icon .. " "
|
|
end,
|
|
highlight = function(ctx)
|
|
return 'BlinkCmpKind' .. ctx.kind
|
|
end,
|
|
},
|
|
kind = {
|
|
text = function(ctx)
|
|
return "(" .. ctx.kind .. ")"
|
|
end,
|
|
highlight = "Comment",
|
|
},
|
|
label = {
|
|
width = { fill = true, max = 60 },
|
|
text = function(ctx)
|
|
return ctx.label
|
|
end,
|
|
highlight = function(ctx)
|
|
return ctx.deprecated and "BlinkCmpLabelDeprecated" or "BlinkCmpLabel"
|
|
end,
|
|
},
|
|
},
|
|
treesitter = { "lsp" }
|
|
}
|
|
},
|
|
|
|
documentation = {
|
|
auto_show = true,
|
|
auto_show_delay_ms = 200,
|
|
update_delay_ms = 50,
|
|
window = {
|
|
border = 'rounded',
|
|
winblend = vim.o.pumblend,
|
|
winhighlight = 'Normal:NormalFloat,FloatBorder:FloatBorder',
|
|
max_width = 80,
|
|
max_height = 20,
|
|
}
|
|
},
|
|
|
|
ghost_text = {
|
|
enabled = vim.g.ai_cmp or false,
|
|
},
|
|
},
|
|
|
|
appearance = {
|
|
use_nvim_cmp_as_default = true,
|
|
nerd_font_variant = 'mono'
|
|
},
|
|
sources = {
|
|
default = {
|
|
'lsp',
|
|
'path',
|
|
'snippets',
|
|
'buffer',
|
|
},
|
|
|
|
providers = {
|
|
lsp = {
|
|
name = "LSP",
|
|
module = "blink.cmp.sources.lsp",
|
|
score_offset = 90,
|
|
},
|
|
path = {
|
|
name = "Path",
|
|
module = "blink.cmp.sources.path",
|
|
score_offset = 3,
|
|
opts = {
|
|
trailing_slash = false,
|
|
label_trailing_slash = true,
|
|
get_cwd = function (context) return vim.fn.getcwd() end,
|
|
show_hidden_files_by_default = true,
|
|
}
|
|
},
|
|
snippets = {
|
|
name = "Snippets",
|
|
module = "blink.cmp.sources.snippets",
|
|
score_offset = 85,
|
|
opts = {
|
|
friendly_snippets = true,
|
|
search_paths = { vim.fn.stdpath("config") .. "/snippets" },
|
|
global_snippets = { "all" },
|
|
extended_filetypes = {},
|
|
ignored_filetypes = {},
|
|
}
|
|
},
|
|
buffer = {
|
|
name = "Buffer",
|
|
module = "blink.cmp.sources.buffer",
|
|
},
|
|
cmdline = {
|
|
name = "Cmdline",
|
|
module = "blink.cmp.sources.cmdline",
|
|
},
|
|
},
|
|
},
|
|
})
|
|
end
|
|
|
|
return M
|