return {
|
|
'saghen/blink.cmp',
|
|
event = { "InsertEnter", "CmdlineEnter" },
|
|
dependencies = {
|
|
{ 'rafamadriz/friendly-snippets' },
|
|
{ 'kristijanhusak/vim-dadbod-completion', ft = { 'sql', 'mysql', 'plsql' }, lazy = true },
|
|
{ 'saghen/blink.compat', version = '2.*', lazy = true, opts = {} },
|
|
},
|
|
|
|
version = '1.*',
|
|
opts = {
|
|
completion = {
|
|
accept = {
|
|
auto_brackets = {
|
|
enabled = true,
|
|
},
|
|
},
|
|
menu = {
|
|
auto_show = true,
|
|
winblend = vim.o.pumblend,
|
|
scrollbar = true,
|
|
border = 'single',
|
|
max_items = 200,
|
|
draw = {
|
|
columns = {
|
|
{ "label", "label_description", gap = 1 },
|
|
{ "kind_icon", "kind", gap = 1 }
|
|
},
|
|
components = {
|
|
kind_icon = {
|
|
ellipsis = false,
|
|
text = function(ctx)
|
|
return ctx.kind_icon .. ctx.icon_gap
|
|
end,
|
|
highlight = function(ctx)
|
|
return 'BlinkCmpKind' .. ctx.kind
|
|
end,
|
|
}
|
|
},
|
|
treesitter = { "lsp" }
|
|
}
|
|
},
|
|
|
|
documentation = {
|
|
auto_show = true,
|
|
auto_show_delay_ms = 200,
|
|
update_delay_ms = 50,
|
|
window = {
|
|
border = 'single',
|
|
winblend = vim.o.pumblend,
|
|
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',
|
|
'dadbod',
|
|
'laravel',
|
|
},
|
|
|
|
providers = {
|
|
dadbod = {
|
|
name = "Dadbod",
|
|
module = "vim_dadbod_completion.blink",
|
|
score_offset = 85,
|
|
},
|
|
laravel = {
|
|
name = "laravel",
|
|
module = "blink.compat.source",
|
|
score_offset = 80,
|
|
},
|
|
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",
|
|
opts = {
|
|
max_items = 5,
|
|
keyword_length = 2,
|
|
}
|
|
},
|
|
cmdline = {
|
|
name = "Cmdline",
|
|
module = "blink.cmp.sources.cmdline",
|
|
},
|
|
},
|
|
},
|
|
|
|
cmdline = {
|
|
sources = function()
|
|
local type = vim.fn.getcmdtype()
|
|
if type == "/" or type == "?" then
|
|
return { 'buffer' }
|
|
end
|
|
if type == ":" then
|
|
return { 'cmdline' }
|
|
end
|
|
return {}
|
|
end,
|
|
},
|
|
|
|
signature = {
|
|
enabled = true,
|
|
window = {
|
|
border = 'single',
|
|
winblend = vim.o.pumblend,
|
|
},
|
|
},
|
|
},
|
|
opts_extend = { "sources.default" },
|
|
config = function(_, opts)
|
|
require('blink.cmp').setup(opts)
|
|
|
|
-- Optional: Set up highlights
|
|
vim.api.nvim_set_hl(0, 'BlinkCmpMenu', { link = 'Pmenu' })
|
|
vim.api.nvim_set_hl(0, 'BlinkCmpMenuBorder', { link = 'Pmenu' })
|
|
vim.api.nvim_set_hl(0, 'BlinkCmpMenuSelection', { link = 'PmenuSel' })
|
|
vim.api.nvim_set_hl(0, 'BlinkCmpDoc', { link = 'NormalFloat' })
|
|
vim.api.nvim_set_hl(0, 'BlinkCmpDocBorder', { link = 'FloatBorder' })
|
|
vim.api.nvim_set_hl(0, 'BlinkCmpSignatureHelp', { link = 'NormalFloat' })
|
|
vim.api.nvim_set_hl(0, 'BlinkCmpSignatureHelpBorder', { link = 'FloatBorder' })
|
|
end
|
|
}
|