109 lines
2.8 KiB
Lua
109 lines
2.8 KiB
Lua
return {
|
|
"saghen/blink.cmp",
|
|
lazy = false,
|
|
version = "*",
|
|
dependencies = {
|
|
"rafamadriz/friendly-snippets",
|
|
"giuxtaposition/blink-cmp-copilot",
|
|
"folke/lazydev.nvim",
|
|
{ "saghen/blink.compat", version = "*", },
|
|
},
|
|
opts = function()
|
|
local window_options = {
|
|
border = "rounded",
|
|
winblend = vim.o.pumblend,
|
|
}
|
|
|
|
---@module 'blink.cmp'
|
|
---@type blink.cmp.Config
|
|
return {
|
|
sources = {
|
|
providers = {
|
|
dadbod = { name = "Dadbod", module = "vim_dadbod_completion.blink" },
|
|
lazydev = { name = "LazyDev", module = "lazydev.integrations.blink" },
|
|
copilot = {
|
|
name = "copilot",
|
|
module = "blink-cmp-copilot",
|
|
score_offset = 5,
|
|
enabled = function()
|
|
if vim.g.copilot_autocomplete_enabled == nil then
|
|
return false
|
|
end
|
|
return vim.g.copilot_autocomplete_enabled
|
|
end,
|
|
},
|
|
luasnip = {
|
|
name = 'luasnip',
|
|
module = 'blink.compat.source',
|
|
score_offset = -3,
|
|
opts = {
|
|
use_show_condition = false,
|
|
show_autosnippets = true,
|
|
},
|
|
},
|
|
},
|
|
-- nvim-cmp sources
|
|
compat = {},
|
|
completion = {
|
|
enabled_providers = {
|
|
"copilot",
|
|
"lsp",
|
|
"path",
|
|
"snippets",
|
|
"buffer",
|
|
"dadbod",
|
|
"lazydev",
|
|
},
|
|
},
|
|
},
|
|
accept = {
|
|
auto_brackets = { enabled = true },
|
|
expand_snippet = function(snippet) require('luasnip').lsp_expand(snippet) end,
|
|
},
|
|
-- trigger = { signature_help = { enabled = true } },
|
|
keymap = {
|
|
preset = "enter",
|
|
["<C-j>"] = { 'select_next', 'fallback' },
|
|
["<C-k>"] = { 'select_prev', 'fallback' },
|
|
["<C-u>"] = { 'scroll_documentation_up', 'fallback' },
|
|
["<C-d>"] = { 'scroll_documentation_down', 'fallback' },
|
|
},
|
|
highlight = {
|
|
-- sets the fallback highlight groups to nvim-cmp's highlight groups
|
|
-- useful for when your theme doesn't support blink.cmp
|
|
-- will be removed in a future release, assuming themes add support
|
|
use_nvim_cmp_as_default = false,
|
|
},
|
|
-- set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
|
|
-- adjusts spacing to ensure icons are aligned
|
|
nerd_font_variant = "mono",
|
|
windows = {
|
|
autocomplete = vim.tbl_extend("force", window_options, {
|
|
selection = "manual",
|
|
---@type blink.cmp.Draw
|
|
draw = {
|
|
components = {
|
|
kind_icon = {
|
|
text = function(ctx)
|
|
if ctx.item.source_name == "copilot" then
|
|
ctx.kind_icon = require("aleidk.constants").icons.kinds.Copilot
|
|
end
|
|
|
|
return ctx.kind_icon .. ctx.icon_gap
|
|
end,
|
|
}
|
|
}
|
|
}
|
|
}),
|
|
documentation = vim.tbl_extend("force", window_options, {
|
|
auto_show = true,
|
|
winblend = 0,
|
|
}),
|
|
ghost_text = {
|
|
enabled = true,
|
|
},
|
|
},
|
|
kind_icons = require("aleidk.constants").icons.kinds,
|
|
}
|
|
end
|
|
}
|