From 1c6e4486cf5c13f67fb737e34b34f9ed2a6714a0 Mon Sep 17 00:00:00 2001 From: Peter Sheehan <145384599+peter-bread@users.noreply.github.com> Date: Fri, 16 Jan 2026 02:22:13 +0000 Subject: [PATCH 01/10] feat: replace `peter.util.list.uniq` with `vim.list.unique` --- lua/peter/plugins/core/treesitter.lua | 3 +-- lua/peter/plugins/lsp/mason.lua | 3 +-- lua/peter/util/list.lua | 27 ++++++++++++--------------- 3 files changed, 14 insertions(+), 19 deletions(-) diff --git a/lua/peter/plugins/core/treesitter.lua b/lua/peter/plugins/core/treesitter.lua index 52cda3f0..221803c9 100644 --- a/lua/peter/plugins/core/treesitter.lua +++ b/lua/peter/plugins/core/treesitter.lua @@ -39,12 +39,11 @@ return { ---@param opts peter.treesitter.Config config = function(_, opts) local nts = require("nvim-treesitter") - local list = require("peter.util.list") local autocmds = require("peter.util.autocmds") nts.setup(opts --[[@as TSConfig]]) - local ensure_installed = list.uniq(opts.ensure_installed or {}) + local ensure_installed = vim.list.unique(opts.ensure_installed or {}) local already_installed = nts.get_installed() diff --git a/lua/peter/plugins/lsp/mason.lua b/lua/peter/plugins/lsp/mason.lua index 7cf9282f..445b2aaa 100644 --- a/lua/peter/plugins/lsp/mason.lua +++ b/lua/peter/plugins/lsp/mason.lua @@ -41,8 +41,7 @@ return { ---@param opts peter.mason.Opts config = function(_, opts) - local list = require("peter.util.list") - opts.ensure_installed = list.uniq(opts.ensure_installed or {}) + opts.ensure_installed = vim.list.unique(opts.ensure_installed or {}) require("mason").setup(opts --[[@as MasonSettings]]) diff --git a/lua/peter/util/list.lua b/lua/peter/util/list.lua index 698768f6..76f3607d 100644 --- a/lua/peter/util/list.lua +++ b/lua/peter/util/list.lua @@ -7,21 +7,18 @@ local M = {} -- --[[ ---------------------------------------------------------------------- ]] ----Remove duplicate elements from a list. ----@param list any[] List to remove duplicates from. ----@return any[] new_list List with duplicates removed. -function M.uniq(list) - local hash = {} - local ret = {} - - for _, v in ipairs(list) do - if not hash[v] then - ret[#ret + 1] = v - hash[v] = true - end - end - - return ret +---Removes duplicate values from a list-like table without modifying the original +---table. +--- +---The input table is not modified. A new table is created by this function. +--- +---For in-place deduplication, see `:h vim.list.unique`. +--- +---@generic T +---@param t T[] +---@return T[] t A new, deduplicated list. +function M.uniq_copy(t) + return vim.list.unique(vim.deepcopy(t)) end return M From 16b5bb1350544541cc34bfb4bd2ced3c9a351bc9 Mon Sep 17 00:00:00 2001 From: Peter Sheehan <145384599+peter-bread@users.noreply.github.com> Date: Sat, 22 Aug 2026 00:40:30 +0100 Subject: [PATCH 02/10] refactor(lsp): use new codelens API --- lua/peter/config/lsp.lua | 2 +- lua/peter/util/lsp.lua | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lua/peter/config/lsp.lua b/lua/peter/config/lsp.lua index f5dc8a39..f9e9782f 100644 --- a/lua/peter/config/lsp.lua +++ b/lua/peter/config/lsp.lua @@ -69,7 +69,7 @@ do -- No more progress; the LSP is idle. active_tokens_by_client[client_id] = nil - vim.lsp.codelens.refresh() + vim.lsp.codelens.enable(true) end end, }) diff --git a/lua/peter/util/lsp.lua b/lua/peter/util/lsp.lua index ef9fb053..0161be65 100644 --- a/lua/peter/util/lsp.lua +++ b/lua/peter/util/lsp.lua @@ -74,7 +74,9 @@ function M.try_enable_codelens(client, bufnr) group = autocmds.augroup("RefreshCodeLens"), desc = "Refresh CodeLens", buffer = bufnr, - callback = vim.lsp.codelens.refresh, + callback = function() + vim.lsp.codelens.enable(true) + end, }) end end @@ -296,7 +298,7 @@ function M.set_default_keymaps(client, bufnr) has = "textDocument/codeLens", }) - map("cC", vim.lsp.codelens.refresh, { + map("cC", function() vim.lsp.codelens.enable(true) end, { desc = "Refresh Codelens", has = "textDocument/codeLens", }) From e5d4ea54e807ef40e34d05762165c55fd532b9e5 Mon Sep 17 00:00:00 2001 From: Peter Sheehan <145384599+peter-bread@users.noreply.github.com> Date: Sun, 23 Aug 2026 17:07:53 +0100 Subject: [PATCH 03/10] fix(lsp): disable default codelens mapping Refs: #142 --- lua/peter/util/lsp.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/peter/util/lsp.lua b/lua/peter/util/lsp.lua index 0161be65..019fcce0 100644 --- a/lua/peter/util/lsp.lua +++ b/lua/peter/util/lsp.lua @@ -91,6 +91,7 @@ function M.delete_global_defaults() del("n", "grn") -- Rename. del("n", "grr") -- References. del("n", "grt") -- Type definition. + del("n", "grx") -- Run codelens. del("n", "gO") -- Document symbols. del("i", "") -- Signature help. From 70ed03be7e0e99a7a745b10f1cc0f3b3240002ef Mon Sep 17 00:00:00 2001 From: Peter Sheehan <145384599+peter-bread@users.noreply.github.com> Date: Sun, 23 Aug 2026 17:08:14 +0100 Subject: [PATCH 04/10] feat: require nvim 0.12+ Refs: #142 --- init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index 73937204..1f1a70f0 100644 --- a/init.lua +++ b/init.lua @@ -1,6 +1,6 @@ -if vim.fn.has("nvim-0.11") ~= 1 then +if vim.fn.has("nvim-0.12") ~= 1 then vim.notify_once( - "peter.nvim requires Neovim 0.11 or above. " + "peter.nvim requires Neovim 0.12 or above. " .. "Current version: " .. require("peter.util.version").string() .. ". " From 17b9423dffe685c506af2d89b5b66dc05b133b4c Mon Sep 17 00:00:00 2001 From: Peter Sheehan <145384599+peter-bread@users.noreply.github.com> Date: Sun, 23 Aug 2026 17:18:44 +0100 Subject: [PATCH 05/10] feat(ui): enable ui2 Refs: #142 --- init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/init.lua b/init.lua index 1f1a70f0..fcf0ee1c 100644 --- a/init.lua +++ b/init.lua @@ -13,3 +13,5 @@ if vim.fn.has("nvim-0.12") ~= 1 then end require("peter.config") + +require("vim._core.ui2").enable() From 78babe0ac2bdd3fb3e5c082da94052e02314f727 Mon Sep 17 00:00:00 2001 From: Peter Sheehan <145384599+peter-bread@users.noreply.github.com> Date: Sun, 23 Aug 2026 22:16:38 +0100 Subject: [PATCH 06/10] refactor(diagnostic): use severities instead of strings --- lua/peter/config/keymaps.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lua/peter/config/keymaps.lua b/lua/peter/config/keymaps.lua index f5eebeba..a620b2a6 100644 --- a/lua/peter/config/keymaps.lua +++ b/lua/peter/config/keymaps.lua @@ -68,13 +68,15 @@ set("n", "cd", vim.diagnostic.open_float, { desc = "Line diagnostics" }) do local diagnostic = require("peter.util.diagnostic") local next, prev = diagnostic.next, diagnostic.prev + local ERROR = vim.diagnostic.severity.ERROR + local WARN = vim.diagnostic.severity.ERROR -- stylua: ignore start set("n", "]d", next, { desc = "Next Diagnostic" }) set("n", "[d", prev, { desc = "Prev Diagnostic" }) - set("n", "]e", function() next({ severity = "ERROR" }) end, { desc = "Next Error" }) - set("n", "[e", function() prev({ severity = "ERROR" }) end, { desc = "Prev Error" }) - set("n", "]w", function() next({ severity = "WARN" }) end, { desc = "Next Warning" }) - set("n", "[w", function() prev({ severity = "WARN" }) end, { desc = "Prev Warning" }) + set("n", "]e", function() next({ severity = ERROR }) end, { desc = "Next Error" }) + set("n", "[e", function() prev({ severity = ERROR }) end, { desc = "Prev Error" }) + set("n", "]w", function() next({ severity = WARN }) end, { desc = "Next Warning" }) + set("n", "[w", function() prev({ severity = WARN }) end, { desc = "Prev Warning" }) -- stylua: ignore end end From d98fecd5081e29738733c94d9bc18c0ddf5c9dae Mon Sep 17 00:00:00 2001 From: Peter Sheehan <145384599+peter-bread@users.noreply.github.com> Date: Mon, 24 Aug 2026 22:40:42 +0100 Subject: [PATCH 07/10] feat(codelens): simplify codelens config --- lua/peter/config/lsp.lua | 97 ++++++++++++++++++++-------------------- lua/peter/util/lsp.lua | 12 +---- 2 files changed, 51 insertions(+), 58 deletions(-) diff --git a/lua/peter/config/lsp.lua b/lua/peter/config/lsp.lua index f9e9782f..f5f2bbb6 100644 --- a/lua/peter/config/lsp.lua +++ b/lua/peter/config/lsp.lua @@ -1,5 +1,4 @@ local lsp = require("peter.util.lsp") -local autocmds = require("peter.util.autocmds") -- Enable LSPs *after* 'mason.nvim' install directory has been added to `PATH`. -- @@ -27,50 +26,52 @@ lsp.on_attach(function(client, bufnr) lsp.try_enable_codelens(client, bufnr) end) -do - -- Store active progress tokens for all running clients. - local active_tokens_by_client = {} - - vim.api.nvim_create_autocmd("LspProgress", { - group = autocmds.augroup("LspProgressCodeLens"), - desc = "Refresh CodeLens whenever the LSP becomes idle", - callback = function(ev) - local client_id = ev.data.client_id - local client = vim.lsp.get_client_by_id(client_id) - - if not client or not client:supports_method("textDocument/codeLens") then - return - end - - local value = ev.data.params.value - local token = ev.data.params.token - - if not (value and token) then - return - end - - -- stylua: ignore - active_tokens_by_client[client_id] = active_tokens_by_client[client_id] or {} - - -- Active tokens for the current client. - local active_tokens = active_tokens_by_client[client_id] - - if value.kind == "begin" then - active_tokens[token] = true - elseif value.kind == "end" then - active_tokens[token] = nil - - -- Check if all tokens are done. - for _, active in pairs(active_tokens) do - if active then - return - end - end - - -- No more progress; the LSP is idle. - active_tokens_by_client[client_id] = nil - vim.lsp.codelens.enable(true) - end - end, - }) -end +-- do +-- local autocmds = require("peter.util.autocmds") +-- +-- -- Store active progress tokens for all running clients. +-- local active_tokens_by_client = {} +-- +-- vim.api.nvim_create_autocmd("LspProgress", { +-- group = autocmds.augroup("LspProgressCodeLens"), +-- desc = "Refresh CodeLens whenever the LSP becomes idle", +-- callback = function(ev) +-- local client_id = ev.data.client_id +-- local client = vim.lsp.get_client_by_id(client_id) +-- +-- if not client or not client:supports_method("textDocument/codeLens") then +-- return +-- end +-- +-- local value = ev.data.params.value +-- local token = ev.data.params.token +-- +-- if not (value and token) then +-- return +-- end +-- +-- -- stylua: ignore +-- active_tokens_by_client[client_id] = active_tokens_by_client[client_id] or {} +-- +-- -- Active tokens for the current client. +-- local active_tokens = active_tokens_by_client[client_id] +-- +-- if value.kind == "begin" then +-- active_tokens[token] = true +-- elseif value.kind == "end" then +-- active_tokens[token] = nil +-- +-- -- Check if all tokens are done. +-- for _, active in pairs(active_tokens) do +-- if active then +-- return +-- end +-- end +-- +-- -- No more progress; the LSP is idle. +-- active_tokens_by_client[client_id] = nil +-- vim.lsp.codelens.enable(true) +-- end +-- end, +-- }) +-- end diff --git a/lua/peter/util/lsp.lua b/lua/peter/util/lsp.lua index 019fcce0..6a8bdf32 100644 --- a/lua/peter/util/lsp.lua +++ b/lua/peter/util/lsp.lua @@ -64,20 +64,12 @@ function M.try_enable_inlay_hints(client, bufnr) end ---Enable LSP Codelens for the current buffer if the LSP supports it. ----See `:h vim.lsp.codelens.refresh`. +---See `:h vim.lsp.codelens.enable`. ---@param client vim.lsp.Client ---@param bufnr integer function M.try_enable_codelens(client, bufnr) - local autocmds = require("peter.util.autocmds") if client:supports_method("textDocument/codeLens") then - vim.api.nvim_create_autocmd({ "BufEnter", "InsertLeave", "BufWritePost" }, { - group = autocmds.augroup("RefreshCodeLens"), - desc = "Refresh CodeLens", - buffer = bufnr, - callback = function() - vim.lsp.codelens.enable(true) - end, - }) + vim.lsp.codelens.enable(true, { bufnr = bufnr }) end end From 8932749fafbb033c02e4dcc9094650f4d29f19df Mon Sep 17 00:00:00 2001 From: Peter Sheehan <145384599+peter-bread@users.noreply.github.com> Date: Thu, 3 Sep 2026 22:29:58 +0100 Subject: [PATCH 08/10] chore(lazy): update `lazy-lock.json` --- lazy-lock.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 490facbd..60b9ad43 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -4,7 +4,7 @@ "blink.cmp": { "branch": "main", "commit": "78336bc89ee5365633bcf754d93df01678b5c08f" }, "conform.nvim": { "branch": "master", "commit": "016802de402556da54c36bd7359b441266b01cdd" }, "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, - "flash.nvim": { "branch": "main", "commit": "b6346946d10d07998efee029fb0f7a593806d0cd" }, + "flash.nvim": { "branch": "main", "commit": "5f0f270fdc7c5b0c21d903ee85b9cb06f2ac636a" }, "haskell-tools.nvim": { "branch": "master", "commit": "d223712c767011350ed887c3152da4955d9b1457" }, "kanagawa.nvim": { "branch": "master", "commit": "bb85e4bfc8d89b0e62c8fa53ccdd13d12e2f77b3" }, "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, @@ -14,11 +14,11 @@ "mini.align": { "branch": "main", "commit": "77d7446b9f2452193f13ced9fb73a8b3aa4a4f4d" }, "mini.icons": { "branch": "main", "commit": "98faae31e9be1cc054ae63485e58ceb185efcad0" }, "mini.surround": { "branch": "main", "commit": "8d5d0c5aa92449368ac251e85451d79d8f69d296" }, - "neogit": { "branch": "master", "commit": "e43a7e83158fc98cd41b732dcb5e1721abb9f164" }, + "neogit": { "branch": "master", "commit": "5adc81b26232954cd7a90f158aa7844c18fc3165" }, "nvim-ansible": { "branch": "main", "commit": "c7f595d568b588942d4d0c37b5cd6cae3764a148" }, - "nvim-autopairs": { "branch": "master", "commit": "7b9923abad60b903ece7c52940e1321d39eccc79" }, + "nvim-autopairs": { "branch": "master", "commit": "430522f95fe4fb7c511ec64f8c1a90cc6a66c05c" }, "nvim-lint": { "branch": "master", "commit": "0370fe965697aa8f04252a1562441bdc13723cd1" }, - "nvim-lspconfig": { "branch": "master", "commit": "bff1bd61cb1455040533201ca1edf1e84efa578f" }, + "nvim-lspconfig": { "branch": "master", "commit": "221c43884319e791519f0d6c94a7f2fbcd653278" }, "nvim-treesitter": { "branch": "main", "commit": "ecdae44baefeffceade8b0c752d80ececad28e76" }, "nvim-treesitter-textobjects": { "branch": "main", "commit": "898ee307df58f854d11cd7edd06472574d48014e" }, "oil.nvim": { "branch": "master", "commit": "b73018b75affd13fa38e2fc94ef753b465f770d7" }, From 32220b5d025c988311bd40dd77e3f01cbcc3b7de Mon Sep 17 00:00:00 2001 From: Peter Sheehan <145384599+peter-bread@users.noreply.github.com> Date: Thu, 3 Sep 2026 22:30:11 +0100 Subject: [PATCH 09/10] feat(lsp): add rust_analyzer config --- after/lsp/rust_analyzer.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 after/lsp/rust_analyzer.lua diff --git a/after/lsp/rust_analyzer.lua b/after/lsp/rust_analyzer.lua new file mode 100644 index 00000000..042de447 --- /dev/null +++ b/after/lsp/rust_analyzer.lua @@ -0,0 +1,13 @@ +-- Rust Analyzer +-- https://rust-analyzer.github.io/book/index.html +-- https://rust-analyzer.github.io/book/configuration.html + +---@type vim.lsp.Config +return { + ---@type lspconfig.settings.rust_analyzer + settings = { + ["rust-analyzer"] = { + lens = { location = "above_whole_item" }, + }, + }, +} From 4604b75cdcfa4d35a73ed166f7b3195663421928 Mon Sep 17 00:00:00 2001 From: Peter Sheehan <145384599+peter-bread@users.noreply.github.com> Date: Thu, 3 Sep 2026 22:38:17 +0100 Subject: [PATCH 10/10] feat: drop plenary dependency --- lazy-lock.json | 1 - lua/peter/plugins/core/git.lua | 1 - 2 files changed, 2 deletions(-) diff --git a/lazy-lock.json b/lazy-lock.json index 60b9ad43..4148aaef 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -22,7 +22,6 @@ "nvim-treesitter": { "branch": "main", "commit": "ecdae44baefeffceade8b0c752d80ececad28e76" }, "nvim-treesitter-textobjects": { "branch": "main", "commit": "898ee307df58f854d11cd7edd06472574d48014e" }, "oil.nvim": { "branch": "master", "commit": "b73018b75affd13fa38e2fc94ef753b465f770d7" }, - "plenary.nvim": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" }, "snacks.nvim": { "branch": "main", "commit": "882c996cf28183f4d63640de0b4c02ec886d01f2" }, "vim-matchup": { "branch": "master", "commit": "5e3c4a3274a9766aee520caebb52572c007fc4f8" }, "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" } diff --git a/lua/peter/plugins/core/git.lua b/lua/peter/plugins/core/git.lua index fe96984f..39956aad 100644 --- a/lua/peter/plugins/core/git.lua +++ b/lua/peter/plugins/core/git.lua @@ -12,7 +12,6 @@ return { { "NeogitOrg/neogit", dependencies = { - "nvim-lua/plenary.nvim", "sindrets/diffview.nvim", "nvim-mini/mini.icons", },