feat(nvim): use blink.cmp
This commit is contained in:
@@ -1,64 +1,33 @@
|
||||
local cmp = require("cmp")
|
||||
|
||||
--- @module "blink.cmp"
|
||||
--- @type blink.cmp.Config
|
||||
M = {
|
||||
window = {
|
||||
completion = {
|
||||
border = "rounded",
|
||||
scrollbar = "║",
|
||||
},
|
||||
documentation = {
|
||||
border = "rounded",
|
||||
scrollbar = "║",
|
||||
keymap = {
|
||||
-- <Tab> to accept
|
||||
preset = "super-tab",
|
||||
},
|
||||
appearance = {
|
||||
nerd_font_variant = "mono",
|
||||
},
|
||||
completion = {
|
||||
-- By default, you may press `<c-space>` to show the documentation.
|
||||
-- Optionally, set `auto_show = true` to show the documentation after a delay.
|
||||
documentation = { auto_show = true, auto_show_delay_ms = 1000 },
|
||||
},
|
||||
sources = {
|
||||
default = { "lsp", "path", "snippets", "lazydev" },
|
||||
providers = {
|
||||
lazydev = { module = "lazydev.integrations.blink", score_offset = 100 },
|
||||
},
|
||||
},
|
||||
formatting = {
|
||||
format = require("lspkind").cmp_format({
|
||||
mode = "symbol",
|
||||
maxwidth = 50,
|
||||
ellipsis_char = "...",
|
||||
}),
|
||||
snippets = { preset = "luasnip" },
|
||||
|
||||
-- See :h blink-cmp-config-fuzzy for more information
|
||||
fuzzy = {
|
||||
implementation = "lua",
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<Escape>"] = cmp.mapping.abort(),
|
||||
["<Tab>"] = cmp.mapping.confirm({ select = true }),
|
||||
["<Up>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {
|
||||
"i",
|
||||
"s",
|
||||
}),
|
||||
["<Down>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {
|
||||
"i",
|
||||
"s",
|
||||
}),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "path" },
|
||||
}, {
|
||||
{ name = "buffer" },
|
||||
}),
|
||||
|
||||
-- Shows a signature help window while you type arguments for a function
|
||||
signature = { enabled = true },
|
||||
}
|
||||
|
||||
vim.o.wildmenu = true
|
||||
vim.o.pumheight = 10
|
||||
|
||||
return M
|
||||
|
||||
Reference in New Issue
Block a user