Void Linux workstation powered by niri, Fish and NeoVim. Contains scripts, browser extensions, custom XBPS packages, and typst plugins. git.anhgelus.world/anhgelus/dotfiles
void niri fish neovim nvim vim dotfiles linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(nvim): prioritize method and functions

+17 -5
+17 -5
config/nvim/lua/plugins/blink.lua
··· 33 33 implementation = "prefer_rust_with_warning", 34 34 max_typos = function(keyword) return math.floor(#keyword / 8) end, 35 35 sorts = { 36 + -- kind priority: 37 + -- 1. keyword 38 + -- 2. variable 39 + -- 3. methods 40 + -- 4. function 36 41 function(a, b) 37 - local kind = require('blink.cmp.types').CompletionItemKind.Keyword 38 - if a.kind == kind and b.kind ~= kind then 39 - return true 40 - elseif a.kind ~= kind and b.kind == kind then 41 - return false 42 + local index = function(t, v) 43 + for index, value in ipairs(t) do 44 + if value == v then return index end 45 + end 46 + return 100 -- using 100 because it is unlikely that I have more than 100 priorities 47 + end 48 + local kind = require('blink.cmp.types').CompletionItemKind 49 + local priority = { kind.Keyword, kind.Variable, kind.Method, kind.Function } 50 + local aIn = index(priority, a) 51 + local bIn = index(priority, b) 52 + if aIn ~= bIn then 53 + return aIn > bIn 42 54 end 43 55 end, 44 56 'score',