1
0
Fork 0
mirror of https://github.com/pnx/dotfiles synced 2026-06-16 03:14:55 +02:00

nvim/lua/user/plugins/editor/autocomplete.lua: update

This commit is contained in:
Henrik Hautakoski 2024-12-29 12:02:45 +01:00
parent 4b299a26df
commit 0f886683f0

View file

@ -3,19 +3,54 @@ local icons = require('user.icons')
return {
'saghen/blink.cmp',
lazy = false,
version = 'v0.*',
build = 'cargo build --release',
dependencies = {
{ 'L3MON4D3/LuaSnip', version = 'v2.*' },
},
opts = {
keymap = { preset = 'enter' },
keymap = {
['<Up>'] = { 'select_prev', 'fallback' },
['<Down>'] = { 'select_next', 'fallback' },
['<C-p>'] = { 'select_prev', 'fallback' },
['<C-n>'] = { 'select_next', 'fallback' },
['<S-Tab>'] = {
function(cmp)
if cmp.snippet_active() then
return cmp.accept()
else
return cmp.select_prev()
end
end,
'snippet_backward',
'fallback'
},
['<Tab>'] = {
function(cmp)
if cmp.snippet_active() then
return cmp.accept()
else
return cmp.select_next()
end
end,
'snippet_forward',
'fallback'
},
['<CR>'] = { 'accept', 'fallback' },
},
appearance = {
nerd_font_variant = 'mono',
kind_icons = icons.symbols
},
sources = {
default = { 'lsp', 'path', 'luasnip', 'buffer' },
default = function(_)
local success, node = pcall(vim.treesitter.get_node)
if success and node and vim.tbl_contains({ 'comment', 'line_comment', 'block_comment' }, node:type()) then
return { 'buffer' }
else
return { 'lsp', 'path', 'luasnip', 'buffer' }
end
end
},
snippets = {
expand = function(snippet) require('luasnip').lsp_expand(snippet) end,
@ -29,18 +64,31 @@ return {
},
completion = {
menu = {
winblend = 5,
min_width = 18,
winblend = 10,
draw = {
columns = {
{ "kind_icon" },
{ "label", "label_description", "source_name", gap = 1 },
},
}
},
documentation = {
auto_show = true,
window = {
winblend = 5
winblend = 10
}
},
ghost_text = {
enabled = true,
}
},
signature = { enabled = true }
signature = {
enabled = true,
window = {
scrollbar = false,
winblend = 10,
}
}
}
}