From 4f0b5fad61739d77fa0a4bb48bff42b9c870c2e4 Mon Sep 17 00:00:00 2001 From: Anhgelus Morhtuuzh Date: Wed, 21 Jan 2026 15:07:52 +0100 Subject: feat(nvim): configure blink completion priority --- config/nvim/lua/plugins/blink.lua | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'config/nvim/lua/plugins/blink.lua') diff --git a/config/nvim/lua/plugins/blink.lua b/config/nvim/lua/plugins/blink.lua index 4603999..6e2ac83 100644 --- a/config/nvim/lua/plugins/blink.lua +++ b/config/nvim/lua/plugins/blink.lua @@ -6,12 +6,11 @@ return { version = "*", opts = { - keymap = { preset = "enter", -- Select completions - [""] = { "select_prev", "fallback" }, - [""] = { "select_next", "fallback" }, + [""] = { "fallback" }, + [""] = { "fallback" }, [""] = { "select_next", "fallback" }, [""] = { "select_prev", "fallback" }, [""] = { "show", "hide", "fallback" }, @@ -30,7 +29,22 @@ return { default = { "lsp", "path", "snippets", "buffer" }, }, - fuzzy = { implementation = "prefer_rust_with_warning" }, + fuzzy = { + implementation = "prefer_rust_with_warning", + max_typos = function(keyword) return math.floor(#keyword / 8) end, + sorts = { + function(a, b) + local kind = require('blink.cmp.types').CompletionItemKind.Keyword + if a.kind == kind and b.kind ~= kind then + return true + elseif a.kind ~= kind and b.kind == kind then + return false + end + end, + 'score', + 'sort_text' + } + }, completion = { -- The keyword should only match against the text before keyword = { range = "prefix" }, -- cgit v1.2.3