From 63feeb9f369fc6176e85c1c2d8fcc863caad1946 Mon Sep 17 00:00:00 2001 From: Robert Günzler Date: Tue, 10 Feb 2026 12:32:48 +0100 Subject: start new MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Robert Günzler --- .config/nvim/lua/plugins/blink.lua | 94 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 .config/nvim/lua/plugins/blink.lua (limited to '.config/nvim/lua/plugins/blink.lua') diff --git a/.config/nvim/lua/plugins/blink.lua b/.config/nvim/lua/plugins/blink.lua new file mode 100644 index 0000000..1122bcc --- /dev/null +++ b/.config/nvim/lua/plugins/blink.lua @@ -0,0 +1,94 @@ +return { + { + 'saghen/blink.cmp', + version = '1.*', + + lazy = false, + + dependencies = { + { 'L3MON4D3/LuaSnip' }, + }, + + init = function() + vim.opt.completeopt = { 'menu', 'menuone', 'noselect' } + vim.opt.shortmess:append('c') + vim.opt.pumheight = 20 -- max height of completion window + + local hl = vim.api.nvim_set_hl + hl(0, 'BlinkCmpSource', { link = 'Comment', force = true }) + hl(0, 'BlinkCmpLabelDescription', { link = 'Comment', force = true }) + end, + + opts_extend = { 'sources.default' }, + + opts = { + -- TODO: + -- 'prefer_rust_with_warning', requires nightly rust, due to: + -- https://github.com/rust-lang/rust/issues/86656 + fuzzy = { + implementation = 'lua', + sorts = { + function(a, b) + local prio = { + snippets = 99, + -- everyting else 0 + } + local a_priority = prio[a.source_id] or 0 + local b_priority = prio[b.source_id] or 0 + if a_priority ~= b_priority then return a_priority > b_priority end + end, + -- defaults + 'score', + 'sort_text' + }, + }, + + appearance = { + -- fallback to cmp highlight names + use_nvim_cmp_as_default = true, + -- adjusts spacing to ensure icons are aligned + -- nerd_font_variant = 'normal', + }, + + sources = { + providers = { + buffer = { min_keyword_length = 3 }, + }, + }, + + completion = { + documentation = { auto_show = true }, + menu = { + draw = { + columns = { + { 'kind_icon' }, + { 'label', 'label_description', gap = 1 }, + { 'source_name' }, + }, + }, + }, + }, + + signature = { + enabled = true, + window = { scrollbar = false }, -- BUG: weird artifacts + }, + + keymap = { + [''] = { 'show', 'show_documentation', 'hide_documentation' }, + [''] = { 'cancel', 'fallback' }, + [''] = { 'select_and_accept' }, + [''] = { 'select_prev', 'fallback' }, + [''] = { 'select_next', 'fallback' }, + [''] = { 'scroll_documentation_up', 'fallback' }, + [''] = { 'scroll_documentation_down', 'fallback' }, + [''] = { 'select_and_accept', 'fallback' }, + [''] = { 'snippet_forward', 'fallback' }, + [''] = { 'snippet_backward', 'fallback' }, + -- [''] = { 'show', 'hide', 'fallback' }, + }, + + snippets = { preset = 'luasnip' }, + }, + }, +} -- cgit 1.4.1