Files
.dotfiles/.config/nvim/lua/plugin/blink-cmp.lua

70 lines
2.4 KiB
Lua

---@module 'lazy'
---@type LazySpec
return { {
'saghen/blink.cmp',
event = 'InsertEnter',
version = '*',
build = 'cargo build --release',
dependencies = {
'saghen/blink.compat',
},
---@module 'blink.cmp'
---@type blink.cmp.Config
opts = {
keymap = {
preset = 'none',
['<tab>'] = { 'accept', 'fallback' }, -- accept the snippet
['<c-space>'] = { 'show', 'show_documentation', 'hide_documentation' }, -- toggle auto-cmp manually
['<c-k>'] = { 'show_signature', 'hide_signature', 'fallback' }, -- toggle signature
['<c-n>'] = { 'select_next', 'fallback' }, -- next item
['<c-p>'] = { 'select_prev', 'fallback' }, -- previous item
['<c-f>'] = { 'scroll_documentation_down', 'fallback' }, -- forwards into the docs
['<c-b>'] = { 'scroll_documentation_up', 'fallback' }, -- backwards into the docs
['<c-e>'] = { 'cancel', 'fallback' }, -- keybind for cancelling completion
},
snippets = { preset = 'luasnip' },
sources = {
default = { 'lsp', 'path', 'snippets' },
},
completion = {
menu = {
auto_show = true, -- whether to automatically show the window when new completion items are available
border = 'rounded',
draw = {
columns = { { "kind_icon" }, { "label", "label_description", gap = 1 }, { 'kind' } },
treesitter = { 'lsp', 'snippets' },
},
},
documentation = {
auto_show = true, -- whether documentation is automatically shown when selecting a completion item
auto_show_delay_ms = 250,
treesitter_highlighting = true,
window = { border = "rounded" },
},
list = { selection = { preselect = true, auto_insert = true } },
trigger = {
show_on_insert_on_trigger_character = true,
show_on_accept_on_trigger_character = true,
show_in_snippet = false,
},
ghost_text = {
enabled = true,
show_with_selection = false, -- whether the ghost text is shown when an item is selected
show_without_selection = true, -- whether the ghost text is shown when no item is selected
show_with_menu = true, -- show ghost text when the menu is open
show_without_menu = true, -- show ghost text when the menu is closed
}
},
fuzzy = {
use_proximity = true,
frecency = { enabled = true, },
prebuilt_binaries = {
download = false, -- we are building from source
}
}
},
config = function(_, opts)
require("blink.cmp").setup(opts)
end
} }