d3c0a10

Branches > main > d3c0a10 > files

misc config changes

Grahp, 2026-10-26

Commit: d3c0a1028bb6e840e2fc7594eefb5491909d2571
Parent: ee9bf10

2 changed files:

nixos/pkgs/plover.nix modified (view file)

@@ -26,7 +26,7 @@ appimageTools.wrapAppImage {   inherit pname version;   src = contents;-  extraPkgs = pkgs: [ pkgs.xcb-util-cursor ];+  extraPkgs = pkgs: [ pkgs.xcb-util-cursor pkgs.hidapi ];    extraInstallCommands = ''     for f in ${contents}/*.desktop; do

nvim/lua/complete.lua modified (view file)

@@ -86,6 +86,20 @@   return vim.list_extend(items, keywords) end +local function mark_buffer_keywords(buf, items)+  local in_buffer = {}+  for _, line in ipairs(api.nvim_buf_get_lines(buf, 0, -1, false)) do+    for token in line:gmatch(symbol_chars .. "+") do+      if token:match("^:[^:]") then in_buffer[token] = true end+    end+  end++  for _, item in ipairs(items) do+    item.in_buffer = in_buffer[item.label]+  end+  return items+end+ local function is_unfiltered_fallback(items, word)   if word == "" or #items < clojure_lsp_max_items then return false end   for _, item in ipairs(items) do@@ -152,7 +166,7 @@       end        local truncated = result.isIncomplete or #items >= clojure_lsp_max_items-      done(add_auto_resolved_keywords(buf, items), client, truncated)+      done(add_auto_resolved_keywords(buf, mark_buffer_keywords(buf, items)), client, truncated)     end, buf)   end   request(5)@@ -217,12 +231,16 @@   end end -local function group_of(item, word_is_capitalized)-  if item.is_local then return 1 end+local function group_of(item, word_is_capitalized, word_is_keyword)+  if item.is_local or (word_is_keyword and item.in_buffer) then return 1 end   if word_is_capitalized and not item.label:match("^%u") then return 3 end   return 2 end +local function wanted(item, word)+  return word:match("^::") or not item.label:match("^::")+end+ local function matching(s, word)   if word == "" then     return vim.tbl_filter(function(item) return item.is_local end, s.items)@@ -231,21 +249,27 @@   local fuzzy = {}   for _, label in ipairs(vim.fn.matchfuzzy(s.labels, word)) do     local item = s.by_label[label]-    if not item.auto_resolved or word:match("^::") then fuzzy[#fuzzy + 1] = item end+    if wanted(item, word) then fuzzy[#fuzzy + 1] = item end   end    local prefixed = vim.tbl_filter(function(item)     return vim.startswith(item.label:lower(), word:lower())   end, fuzzy)-  local items = #prefixed > 0 and prefixed or fuzzy+  local items = (#prefixed > 0 and not word:match("^::")) and prefixed or fuzzy++  local is_prefixed = {}+  for _, item in ipairs(prefixed) do is_prefixed[item] = true end    local fuzzy_rank = {}   for i, item in ipairs(items) do fuzzy_rank[item] = i end   local word_is_capitalized = word:match("^%u") ~= nil+  local word_is_keyword = word:match("^:") ~= nil    table.sort(items, function(a, b)-    local group_a, group_b = group_of(a, word_is_capitalized), group_of(b, word_is_capitalized)+    local group_a = group_of(a, word_is_capitalized, word_is_keyword)+    local group_b = group_of(b, word_is_capitalized, word_is_keyword)     if group_a ~= group_b then return group_a < group_b end+    if is_prefixed[a] ~= is_prefixed[b] then return is_prefixed[a] ~= nil end     if #prefixed > 0 and #a.label ~= #b.label then return #a.label < #b.label end     return fuzzy_rank[a] < fuzzy_rank[b]   end)@@ -373,5 +397,10 @@   session, cancel_fetch, accepted_at = nil, nil, nil end}) +vim.keymap.set("i", "<CR>", function()+  local nothing_selected = vim.fn.pumvisible() == 1 and vim.fn.complete_info({"selected"}).selected == -1+  return nothing_selected and "<C-e><CR>" or "<CR>"+end, {expr = true})+ vim.opt.completeopt = {"menu", "menuone", "noinsert", "noselect"} vim.opt.shortmess:append("c")