152 lines
4 KiB
Lua
152 lines
4 KiB
Lua
return {
|
|
"saghen/blink.cmp",
|
|
build = 'cargo +nightly build --release',
|
|
dependencies = {
|
|
{ "L3MON4D3/LuaSnip", version = "v2.*" }
|
|
},
|
|
lazy = true,
|
|
opts = {
|
|
snippets = { preset = 'luasnip' },
|
|
sources = {
|
|
default = { 'buffer', 'lsp', 'path', 'snippets' },
|
|
},
|
|
fuzzy = { implementation = 'prefer_rust' },
|
|
appearance = {
|
|
nerd_font_variant = 'mono',
|
|
kind_icons = {
|
|
Text = "",
|
|
Method = "",
|
|
Function = "",
|
|
Constructor = "",
|
|
Field = "",
|
|
Variable = "",
|
|
Class = "",
|
|
Interface = "",
|
|
Module = "",
|
|
Property = "",
|
|
Unit = "",
|
|
Value = "",
|
|
Enum = "",
|
|
Keyword = "",
|
|
Snippet = "",
|
|
Color = "",
|
|
File = "",
|
|
Reference = "",
|
|
Folder = "",
|
|
EnumMember = "",
|
|
Constant = "",
|
|
Struct = "",
|
|
Event = "",
|
|
Operator = "",
|
|
TypeParameter = ""
|
|
}
|
|
},
|
|
completion = {
|
|
keyword = {
|
|
range = 'full'
|
|
},
|
|
ghost_text = {
|
|
enabled = true
|
|
},
|
|
menu = {
|
|
winhighlight = 'Normal:NormalFloat,FloatBorder:FloatBorder,CursorLine:CursorLine,Search:None',
|
|
min_width = 40,
|
|
max_height = 25,
|
|
draw = {
|
|
columns = { { 'label', 'label_description', gap = 1 }, { 'kind_icon', 'kind', gap = 1 } },
|
|
components = {
|
|
label = {
|
|
highlight = function(ctx)
|
|
-- label and label details
|
|
local highlights = {
|
|
{ 0, #ctx.label, group = ctx.deprecated and 'DiagnosticFloatingWarn' or 'NormalFloator' },
|
|
}
|
|
if ctx.label_detail then
|
|
table.insert(highlights, { #ctx.label, #ctx.label + #ctx.label_detail, group = 'NormalFloat' })
|
|
end
|
|
|
|
return highlights
|
|
end,
|
|
},
|
|
}
|
|
}
|
|
},
|
|
documentation = {
|
|
auto_show = true,
|
|
auto_show_delay_ms = 0,
|
|
window = {
|
|
|
|
winhighlight = 'Normal:NormalFloat,FloatBorder:FloatBorder,CursorLine:CursorLine',
|
|
}
|
|
},
|
|
},
|
|
keymap = {
|
|
['<C-n>'] = { 'hide', 'show', 'fallback' },
|
|
['<CR>'] = { 'accept', 'fallback' },
|
|
['<Tab>'] = {
|
|
function(cmp)
|
|
if cmp.snippet_active() then
|
|
return cmp.accept()
|
|
else
|
|
return cmp.select_next()
|
|
end
|
|
end,
|
|
'snippet_forward',
|
|
'fallback'
|
|
},
|
|
['<S-Tab>'] = {
|
|
function(cmp)
|
|
if cmp.snippet_active() then
|
|
return cmp.accept()
|
|
else
|
|
return cmp.select_prev()
|
|
end
|
|
end,
|
|
'snippet_backward',
|
|
'fallback'
|
|
},
|
|
['<C-k>'] = { 'select_prev', 'fallback' },
|
|
['<C-j>'] = { 'select_next', 'fallback' },
|
|
['<C-u>'] = { 'scroll_documentation_up', 'fallback' },
|
|
['<C-d>'] = { 'scroll_documentation_down', 'fallback' },
|
|
['<C-s>'] = { 'show_signature', 'hide_signature', 'fallback' },
|
|
},
|
|
signature = {
|
|
enabled = true,
|
|
window = {
|
|
winhighlight = 'Normal:NormalFloat,FloatBorder:FloatBorder',
|
|
}
|
|
},
|
|
cmdline = {
|
|
keymap = { preset = 'inherit', ['<cr>'] = { 'accept_and_enter', 'fallback' } },
|
|
completion = {
|
|
menu = {
|
|
auto_show = function()
|
|
local type = vim.fn.getcmdtype()
|
|
-- Search forward and backward
|
|
if type == "/" or type == "?" then
|
|
return false
|
|
end
|
|
-- Commands
|
|
if type == ":" then
|
|
return true
|
|
end
|
|
return false
|
|
end,
|
|
}
|
|
},
|
|
sources = function()
|
|
local type = vim.fn.getcmdtype()
|
|
-- Search forward and backward
|
|
if type == "/" or type == "?" then
|
|
return { "buffer" }
|
|
end
|
|
-- Commands
|
|
if type == ":" then
|
|
return { "cmdline" }
|
|
end
|
|
return {}
|
|
end,
|
|
},
|
|
}
|
|
}
|