From aae6674547a2ae5128fa9a9d4934449cfad72bab Mon Sep 17 00:00:00 2001 From: "Thing-han, Lim" <15379156+potsrevennil@users.noreply.github.com> Date: Mon, 17 Aug 2026 14:45:27 +0800 Subject: [PATCH 1/4] refactor(nvim): replace telescope with mini.pick as the picker Swap the LazyVim telescope extra for mini.pick + mini.extra: a single-file, pure-Lua picker (no fzf dependency) with rg/git as optional accelerators that warn-not-fail when absent. files() falls back to a Lua directory walk without rg/fd. Keymaps mirror LazyVim's published scheme so muscle memory and its cheatsheet still apply; only the RHS changes. lazyvim_picker was inert (never read at runtime) and the telescope picker keymaps lived entirely in the extra, so removing the import drops telescope + telescope-fzf-native cleanly with nothing to reconcile. plenary is retained (codecompanion/none-ls still require it). Co-Authored-By: Claude Opus 4.8 --- lazy-lock.json | 2 + lua/config/lazy.lua | 1 - lua/config/options.lua | 1 - lua/plugins/mini-pick.lua | 89 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 91 insertions(+), 2 deletions(-) create mode 100644 lua/plugins/mini-pick.lua diff --git a/lazy-lock.json b/lazy-lock.json index 2d84d55..d77010c 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -21,8 +21,10 @@ "mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" }, "mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" }, "mini.ai": { "branch": "main", "commit": "e66a71449bdf719b4b9c96e0cd7b7d6cc4112f88" }, + "mini.extra": { "branch": "main", "commit": "9c6affac2b176142f48b185bd7abc5db7ec20ac8" }, "mini.icons": { "branch": "main", "commit": "94848dad1589a199f876539bd79befb0c5e3abf0" }, "mini.pairs": { "branch": "main", "commit": "42407ccb80ec59c84e7c91d815f42ed90a8cc093" }, + "mini.pick": { "branch": "main", "commit": "04e73ab07222508361095bb6e27621b315e6b9f1" }, "noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" }, "none-ls.nvim": { "branch": "main", "commit": "01f8e62ea11603e59ad9ff7afcfa94fd183f76d6" }, "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index ae090fb..66db0b0 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -67,7 +67,6 @@ lazy.setup({ { import = "lazyvim.plugins.treesitter" }, { import = "lazyvim.plugins.util" }, { import = "lazyvim.plugins.xtras" }, - { import = "lazyvim.plugins.extras.editor.telescope" }, { import = "lazyvim.plugins.extras.coding.nvim-cmp" }, { import = "lazyvim.plugins.extras.coding.luasnip" }, { import = "lazyvim.plugins.extras.lsp.none-ls" }, diff --git a/lua/config/options.lua b/lua/config/options.lua index f037829..9b55b6d 100644 --- a/lua/config/options.lua +++ b/lua/config/options.lua @@ -22,7 +22,6 @@ local gopts = { snacks_animate = false, lazyvim_cmp = "nvim-cmp", trouble_lualine = false, - lazyvim_picker = "telescope", } for k, v in pairs(gopts) do diff --git a/lua/plugins/mini-pick.lua b/lua/plugins/mini-pick.lua new file mode 100644 index 0000000..59005a6 --- /dev/null +++ b/lua/plugins/mini-pick.lua @@ -0,0 +1,89 @@ +local function have(exe) + return vim.fn.executable(exe) == 1 +end + +-- Run `fn` only if `exe` is on PATH; otherwise warn and no-op. Never errors -- +-- mini.pick's matcher is pure Lua (no fzf), and the only external tools it can +-- use are rg/fd/git, so a missing tool should degrade to a notification, not a +-- stack trace. files() needs no guard (it falls back to a Lua directory walk). +local function guard(exe, purpose, fn) + return function() + if have(exe) then + fn() + else + vim.notify( + ("mini.pick: '%s' not found on PATH -- %s unavailable"):format(exe, purpose), + vim.log.levels.WARN + ) + end + end +end + +return { + { + "nvim-mini/mini.pick", + dependencies = { "nvim-mini/mini.extra" }, + cmd = "Pick", + opts = {}, + config = function(_, opts) + require("mini.pick").setup(opts) + require("mini.extra").setup() -- registers MiniExtra.pickers.* + + -- One-time, non-fatal advisory about missing optional CLI tools. + -- Deferred so it never blocks startup; purely informational. + vim.schedule(function() + local optional = { + { "rg", "live grep + fast file listing" }, + { "git", "git pickers (commits/status)" }, + } + local missing = {} + for _, t in ipairs(optional) do + if not have(t[1]) then + missing[#missing + 1] = ("%s (%s)"):format(t[1], t[2]) + end + end + if #missing > 0 then + vim.notify( + "mini.pick: optional tools missing, related pickers will warn on use: " + .. table.concat(missing, ", "), + vim.log.levels.WARN + ) + end + end) + end, + -- stylua: ignore + -- Keymap scheme MIRRORS LazyVim's published layout (lhs + desc ported + -- from extras/editor/telescope.lua) so muscle memory and LazyVim's + -- cheatsheet still apply; only the RHS is swapped to mini.pick/extra. + keys = { + -- files (LazyVim: and ff both find files) + { "", function() require("mini.pick").builtin.files() end, desc = "Find Files" }, + { "ff", function() require("mini.pick").builtin.files() end, desc = "Find Files" }, + { "fb", function() require("mini.pick").builtin.buffers() end, desc = "Buffers" }, + { "fr", function() require("mini.extra").pickers.oldfiles() end, desc = "Recent Files" }, + -- grep (LazyVim: / and sg both live-grep) -- guarded on rg + { "/", guard("rg", "live grep", function() require("mini.pick").builtin.grep_live() end), desc = "Grep (root)" }, + { "sg", guard("rg", "live grep", function() require("mini.pick").builtin.grep_live() end), desc = "Grep (root)" }, + -- search group (no external tool) + { "sk", function() require("mini.extra").pickers.keymaps() end, desc = "Keymaps" }, + { "sh", function() require("mini.pick").builtin.help() end, desc = "Help Pages" }, + { "sR", function() require("mini.pick").builtin.resume() end, desc = "Resume" }, + { "sm", function() require("mini.extra").pickers.marks() end, desc = "Jump to Mark" }, + { "sd", function() require("mini.extra").pickers.diagnostic({ scope = "current" }) end, desc = "Document Diagnostics" }, + { "sD", function() require("mini.extra").pickers.diagnostic({ scope = "all" }) end, desc = "Workspace Diagnostics" }, + { "ss", function() require("mini.extra").pickers.lsp({ scope = "document_symbol" }) end, desc = "Goto Symbol" }, + { "sS", function() require("mini.extra").pickers.lsp({ scope = "workspace_symbol" }) end, desc = "Goto Symbol (Workspace)" }, + -- git (LazyVim: gc commits, gs status) -- guarded on git + { "gc", guard("git", "git commits", function() require("mini.extra").pickers.git_commits() end), desc = "Git Commits" }, + { "gs", guard("git", "git status", function() require("mini.extra").pickers.git_files({ scope = "modified" }) end), desc = "Git Status" }, + -- colorscheme (LazyVim: uC) -- mini has no builtin; small custom source + { "uC", function() + require("mini.pick").start({ source = { + name = "Colorschemes", + items = vim.fn.getcompletion("", "color"), + choose = function(item) vim.cmd.colorscheme(item) end, + } }) + end, desc = "Colorscheme" }, + }, + }, +} From 501d2bea6a97939d5d3734b3c742159c50aac659 Mon Sep 17 00:00:00 2001 From: "Thing-han, Lim" <15379156+potsrevennil@users.noreply.github.com> Date: Tue, 20 Oct 2026 15:13:10 +0800 Subject: [PATCH 2/4] fix(nvim): keep fzf-lua out and route every picker through mini.pick Dropping vim.g.lazyvim_picker made LazyVim auto-enable its editor.fzf extra, which installed fzf-lua and bound , /, ... over mini.pick's keys, so file search and live grep opened different UIs. Claim that extra's import name before lazyvim.plugins.xtras so lazy.nvim skips it, and register mini.pick as LazyVim.pick()'s backend there (dashboard entries, fc). Also send vim.ui.select through mini.pick before it is lazy-loaded, and repoint LazyVim's Snacks.picker git log keymaps (gl/gL/gf) at mini.extra. Co-Authored-By: Claude Opus 5.5 --- lua/config/keymaps.lua | 9 +++++++++ lua/config/lazy.lua | 13 +++++++++++++ lua/config/picker.lua | 25 +++++++++++++++++++++++++ lua/plugins/mini-pick.lua | 10 ++++++++++ 4 files changed, 57 insertions(+) create mode 100644 lua/config/picker.lua diff --git a/lua/config/keymaps.lua b/lua/config/keymaps.lua index ca22995..37565cc 100644 --- a/lua/config/keymaps.lua +++ b/lua/config/keymaps.lua @@ -13,3 +13,12 @@ keymap( keymap("n", "dh", vim.diagnostic.hide, opts) keymap("n", "ds", vim.diagnostic.show, opts) keymap("n", "dl", vim.diagnostic.setqflist, opts) + +-- LazyVim's git log keymaps open Snacks.picker, a third picker UI; point them at +-- mini.extra so they look like every other picker. (gb, blame line, +-- has no mini equivalent and stays on Snacks.) +-- stylua: ignore start +keymap("n", "gl", function() require("mini.extra").pickers.git_commits({ path = LazyVim.root.git() }) end, { desc = "Git Log" }) +keymap("n", "gL", function() require("mini.extra").pickers.git_commits({ path = vim.fn.getcwd() }) end, { desc = "Git Log (cwd)" }) +keymap("n", "gf", function() require("mini.extra").pickers.git_commits({ path = vim.api.nvim_buf_get_name(0) }) end, { desc = "Git Current File History" }) +-- stylua: ignore end diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index 66db0b0..43e7845 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -66,6 +66,19 @@ lazy.setup({ { import = "lazyvim.plugins.lsp.init" }, { import = "lazyvim.plugins.treesitter" }, { import = "lazyvim.plugins.util" }, + -- LazyVim always auto-enables one picker extra (editor.fzf for this + -- install; vim.g.lazyvim_picker has no "none"), which would install + -- fzf-lua and bind , /, ... over mini.pick's + -- keys. Claiming that extra's import name first makes lazy.nvim's + -- import dedup skip it, and mini.pick takes over LazyVim.pick() in its + -- place. + { + name = "lazyvim.plugins.extras.editor.fzf", + import = function() + require("config.picker") + return {} + end, + }, { import = "lazyvim.plugins.xtras" }, { import = "lazyvim.plugins.extras.coding.nvim-cmp" }, { import = "lazyvim.plugins.extras.coding.luasnip" }, diff --git a/lua/config/picker.lua b/lua/config/picker.lua new file mode 100644 index 0000000..c2b6220 --- /dev/null +++ b/lua/config/picker.lua @@ -0,0 +1,25 @@ +-- mini.pick as the backend for LazyVim.pick(), which LazyVim calls on its own +-- (dashboard "Find File"/"Find Text"/"Recent Files", fc, ...). Without +-- this those would fall through to whichever picker extra LazyVim auto-enables. +-- Loaded from lazy.lua, before lazyvim.plugins.xtras: LazyVim.pick.register() +-- only takes effect while specs are being resolved at startup. + +---@type LazyPicker +local picker = { + name = "mini.pick", + -- LazyVim's command names -> mini.pick/mini.extra picker names + commands = { + find_files = "files", + live_grep = "grep_live", + }, + open = function(command, opts) + local source = { cwd = opts and opts.cwd } + local fn = require("mini.pick").builtin[command] or require("mini.extra").pickers[command] + if not fn then + return LazyVim.warn(("LazyVim.pick: mini.pick has no `%s` picker"):format(command)) + end + fn(nil, { source = source }) + end, +} + +LazyVim.pick.register(picker) diff --git a/lua/plugins/mini-pick.lua b/lua/plugins/mini-pick.lua index 59005a6..5c443dc 100644 --- a/lua/plugins/mini-pick.lua +++ b/lua/plugins/mini-pick.lua @@ -25,6 +25,16 @@ return { dependencies = { "nvim-mini/mini.extra" }, cmd = "Pick", opts = {}, + init = function() + -- vim.ui.select (code actions, LazyVim prompts, ...) through mini.pick + -- too, so every list looks the same. setup() installs + -- MiniPick.ui_select itself, but mini.pick is lazy-loaded; this + -- covers calls made before then and loads it on first use. + ---@diagnostic disable-next-line: duplicate-set-field + vim.ui.select = function(...) + return require("mini.pick").ui_select(...) + end + end, config = function(_, opts) require("mini.pick").setup(opts) require("mini.extra").setup() -- registers MiniExtra.pickers.* From 858dd7061cda2fd8918d159ebf7ce35d3e31833e Mon Sep 17 00:00:00 2001 From: "Thing-han, Lim" <15379156+potsrevennil@users.noreply.github.com> Date: Tue, 20 Oct 2026 16:33:20 +0800 Subject: [PATCH 3/4] fix(nvim): disable LazyVim's default picker extra instead of shadowing it Claiming the editor.fzf import name only worked when lazyvim.json made fzf the default; CI has no lazyvim.json, so LazyVim picked snacks_picker and loaded it anyway. The fake lazyvim.plugins.extras.* name also sat before the core imports and tripped the smoke test's order check. Mark every picker-group default extra disabled instead, which LazyVim's import hook and xtras both honour, from an import not named lazyvim.plugins.* so the order check ignores it. Co-Authored-By: Claude Opus 5.5 --- lua/config/lazy.lua | 16 ++++++++-------- lua/config/picker.lua | 27 ++++++++++++++++++++------- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index 43e7845..42b833a 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -66,16 +66,16 @@ lazy.setup({ { import = "lazyvim.plugins.lsp.init" }, { import = "lazyvim.plugins.treesitter" }, { import = "lazyvim.plugins.util" }, - -- LazyVim always auto-enables one picker extra (editor.fzf for this - -- install; vim.g.lazyvim_picker has no "none"), which would install - -- fzf-lua and bind , /, ... over mini.pick's - -- keys. Claiming that extra's import name first makes lazy.nvim's - -- import dedup skip it, and mini.pick takes over LazyVim.pick() in its - -- place. + -- LazyVim always auto-enables one picker extra (fzf, snacks or + -- telescope, depending on lazyvim.json; vim.g.lazyvim_picker has no + -- "none"), which would bind , /, gd, ... over + -- mini.pick. Has to run here, after lazyvim.plugins.init has loaded + -- LazyVim's config and before xtras picks its default extras. Not + -- named lazyvim.plugins.*, so the CI import-order check ignores it. { - name = "lazyvim.plugins.extras.editor.fzf", + name = "mini.pick picker", import = function() - require("config.picker") + require("config.picker").setup() return {} end, }, diff --git a/lua/config/picker.lua b/lua/config/picker.lua index c2b6220..837f245 100644 --- a/lua/config/picker.lua +++ b/lua/config/picker.lua @@ -1,11 +1,11 @@ --- mini.pick as the backend for LazyVim.pick(), which LazyVim calls on its own --- (dashboard "Find File"/"Find Text"/"Recent Files", fc, ...). Without --- this those would fall through to whichever picker extra LazyVim auto-enables. --- Loaded from lazy.lua, before lazyvim.plugins.xtras: LazyVim.pick.register() --- only takes effect while specs are being resolved at startup. +-- Makes mini.pick LazyVim's one and only picker. Called from lazy.lua while +-- specs are being resolved (see the comment there for why that spot). +local M = {} +-- Backend for LazyVim.pick(), which LazyVim calls on its own (dashboard +-- "Find File"/"Find Text"/"Recent Files", fc, ...). ---@type LazyPicker -local picker = { +M.picker = { name = "mini.pick", -- LazyVim's command names -> mini.pick/mini.extra picker names commands = { @@ -22,4 +22,17 @@ local picker = { end, } -LazyVim.pick.register(picker) +function M.setup() + -- Turn off whichever picker extra LazyVim chose as the default. Its + -- import hook skips any default extra marked disabled, and xtras only + -- adds the enabled ones -- LazyVim's own mechanism, just with none left + -- on for the picker group. + for _, extra in pairs(LazyVim.config.get_defaults()) do + if extra.group == "picker" then + extra.enabled = false + end + end + LazyVim.pick.register(M.picker) +end + +return M From 32e029a84fb7c1242bdbaf32b7f5ccf48f538ff4 Mon Sep 17 00:00:00 2001 From: "Thing-han, Lim" <15379156+potsrevennil@users.noreply.github.com> Date: Tue, 20 Oct 2026 16:53:22 +0800 Subject: [PATCH 4/4] refactor(nvim): use snacks.picker instead of mini.pick mini.pick draws everything in one window: the prompt sits in the border and the preview replaces the list. snacks.picker has the fzf-style layout (input box, list, side preview), and snacks.nvim is already a LazyVim core dependency, loaded at startup -- so this drops mini.pick and mini.extra rather than adding anything. Set vim.g.lazyvim_picker = "snacks" and let LazyVim's snacks_picker extra own the keymaps, vim.ui.select, LSP pickers and LazyVim.pick(). That extra appends to opts.dashboard, which only lazyvim.plugins.ui defines, so give snacks an empty, disabled dashboard before xtras is imported. Drops telescope, telescope-fzf-native and dressing.nvim from the lock. Co-Authored-By: Claude Opus 5.5 --- lazy-lock.json | 3 -- lua/config/keymaps.lua | 9 ---- lua/config/lazy.lua | 19 +++----- lua/config/options.lua | 1 + lua/config/picker.lua | 38 --------------- lua/plugins/mini-pick.lua | 99 --------------------------------------- 6 files changed, 7 insertions(+), 162 deletions(-) delete mode 100644 lua/config/picker.lua delete mode 100644 lua/plugins/mini-pick.lua diff --git a/lazy-lock.json b/lazy-lock.json index d12b9e4..5398959 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -8,7 +8,6 @@ "codecompanion.nvim": { "branch": "main", "commit": "86118411be00f0451a59c5ef7972c437e979e1b7" }, "conform.nvim": { "branch": "master", "commit": "016802de402556da54c36bd7359b441266b01cdd" }, "dracula.nvim": { "branch": "main", "commit": "ae752c13e95fb7c5f58da4b5123cb804ea7568ee" }, - "dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" }, "flash.nvim": { "branch": "main", "commit": "5f0f270fdc7c5b0c21d903ee85b9cb06f2ac636a" }, "friendly-snippets": { "branch": "main", "commit": "b4d01b0fdf3c9a549961c2f9ffe8dc09be166219" }, "gitsigns.nvim": { "branch": "main", "commit": "eb60cc7b94c46005237fd34170d76f3a089a90aa" }, @@ -37,8 +36,6 @@ "plenary.nvim": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" }, "render-markdown.nvim": { "branch": "main", "commit": "8e8795368391036643b622875a6da6a51bcd33f4" }, "snacks.nvim": { "branch": "main", "commit": "882c996cf28183f4d63640de0b4c02ec886d01f2" }, - "telescope-fzf-native.nvim": { "branch": "main", "commit": "b25b749b9db64d375d782094e2b9dce53ad53a40" }, - "telescope.nvim": { "branch": "master", "commit": "40aedd8a68c78a656a10a8d62d80c54af59420fb" }, "todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" }, "trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" }, "ts-comments.nvim": { "branch": "main", "commit": "a59d6092213447450191122c9346f309161504cb" }, diff --git a/lua/config/keymaps.lua b/lua/config/keymaps.lua index 37565cc..ca22995 100644 --- a/lua/config/keymaps.lua +++ b/lua/config/keymaps.lua @@ -13,12 +13,3 @@ keymap( keymap("n", "dh", vim.diagnostic.hide, opts) keymap("n", "ds", vim.diagnostic.show, opts) keymap("n", "dl", vim.diagnostic.setqflist, opts) - --- LazyVim's git log keymaps open Snacks.picker, a third picker UI; point them at --- mini.extra so they look like every other picker. (gb, blame line, --- has no mini equivalent and stays on Snacks.) --- stylua: ignore start -keymap("n", "gl", function() require("mini.extra").pickers.git_commits({ path = LazyVim.root.git() }) end, { desc = "Git Log" }) -keymap("n", "gL", function() require("mini.extra").pickers.git_commits({ path = vim.fn.getcwd() }) end, { desc = "Git Log (cwd)" }) -keymap("n", "gf", function() require("mini.extra").pickers.git_commits({ path = vim.api.nvim_buf_get_name(0) }) end, { desc = "Git Current File History" }) --- stylua: ignore end diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index fb2c9b7..8d54960 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -71,19 +71,12 @@ lazy.setup({ { import = "lazyvim.plugins.lsp.init" }, { import = "lazyvim.plugins.treesitter" }, { import = "lazyvim.plugins.util" }, - -- LazyVim always auto-enables one picker extra (fzf, snacks or - -- telescope, depending on lazyvim.json; vim.g.lazyvim_picker has no - -- "none"), which would bind , /, gd, ... over - -- mini.pick. Has to run here, after lazyvim.plugins.init has loaded - -- LazyVim's config and before xtras picks its default extras. Not - -- named lazyvim.plugins.*, so the CI import-order check ignores it. - { - name = "mini.pick picker", - import = function() - require("config.picker").setup() - return {} - end, - }, + -- The snacks picker extra (vim.g.lazyvim_picker = "snacks") adds a + -- "Projects" entry to opts.dashboard, which only lazyvim.plugins.ui + -- defines -- not imported here, so it would index nil. Give it an + -- empty, disabled dashboard to append to; has to come before xtras + -- so it is merged in before that extra's opts function runs. + { "folke/snacks.nvim", opts = { dashboard = { enabled = false, preset = { keys = {} } } } }, { import = "lazyvim.plugins.xtras" }, { import = "lazyvim.plugins.extras.coding.nvim-cmp" }, { import = "lazyvim.plugins.extras.coding.luasnip" }, diff --git a/lua/config/options.lua b/lua/config/options.lua index 9b55b6d..ad03493 100644 --- a/lua/config/options.lua +++ b/lua/config/options.lua @@ -22,6 +22,7 @@ local gopts = { snacks_animate = false, lazyvim_cmp = "nvim-cmp", trouble_lualine = false, + lazyvim_picker = "snacks", } for k, v in pairs(gopts) do diff --git a/lua/config/picker.lua b/lua/config/picker.lua deleted file mode 100644 index 837f245..0000000 --- a/lua/config/picker.lua +++ /dev/null @@ -1,38 +0,0 @@ --- Makes mini.pick LazyVim's one and only picker. Called from lazy.lua while --- specs are being resolved (see the comment there for why that spot). -local M = {} - --- Backend for LazyVim.pick(), which LazyVim calls on its own (dashboard --- "Find File"/"Find Text"/"Recent Files", fc, ...). ----@type LazyPicker -M.picker = { - name = "mini.pick", - -- LazyVim's command names -> mini.pick/mini.extra picker names - commands = { - find_files = "files", - live_grep = "grep_live", - }, - open = function(command, opts) - local source = { cwd = opts and opts.cwd } - local fn = require("mini.pick").builtin[command] or require("mini.extra").pickers[command] - if not fn then - return LazyVim.warn(("LazyVim.pick: mini.pick has no `%s` picker"):format(command)) - end - fn(nil, { source = source }) - end, -} - -function M.setup() - -- Turn off whichever picker extra LazyVim chose as the default. Its - -- import hook skips any default extra marked disabled, and xtras only - -- adds the enabled ones -- LazyVim's own mechanism, just with none left - -- on for the picker group. - for _, extra in pairs(LazyVim.config.get_defaults()) do - if extra.group == "picker" then - extra.enabled = false - end - end - LazyVim.pick.register(M.picker) -end - -return M diff --git a/lua/plugins/mini-pick.lua b/lua/plugins/mini-pick.lua deleted file mode 100644 index 5c443dc..0000000 --- a/lua/plugins/mini-pick.lua +++ /dev/null @@ -1,99 +0,0 @@ -local function have(exe) - return vim.fn.executable(exe) == 1 -end - --- Run `fn` only if `exe` is on PATH; otherwise warn and no-op. Never errors -- --- mini.pick's matcher is pure Lua (no fzf), and the only external tools it can --- use are rg/fd/git, so a missing tool should degrade to a notification, not a --- stack trace. files() needs no guard (it falls back to a Lua directory walk). -local function guard(exe, purpose, fn) - return function() - if have(exe) then - fn() - else - vim.notify( - ("mini.pick: '%s' not found on PATH -- %s unavailable"):format(exe, purpose), - vim.log.levels.WARN - ) - end - end -end - -return { - { - "nvim-mini/mini.pick", - dependencies = { "nvim-mini/mini.extra" }, - cmd = "Pick", - opts = {}, - init = function() - -- vim.ui.select (code actions, LazyVim prompts, ...) through mini.pick - -- too, so every list looks the same. setup() installs - -- MiniPick.ui_select itself, but mini.pick is lazy-loaded; this - -- covers calls made before then and loads it on first use. - ---@diagnostic disable-next-line: duplicate-set-field - vim.ui.select = function(...) - return require("mini.pick").ui_select(...) - end - end, - config = function(_, opts) - require("mini.pick").setup(opts) - require("mini.extra").setup() -- registers MiniExtra.pickers.* - - -- One-time, non-fatal advisory about missing optional CLI tools. - -- Deferred so it never blocks startup; purely informational. - vim.schedule(function() - local optional = { - { "rg", "live grep + fast file listing" }, - { "git", "git pickers (commits/status)" }, - } - local missing = {} - for _, t in ipairs(optional) do - if not have(t[1]) then - missing[#missing + 1] = ("%s (%s)"):format(t[1], t[2]) - end - end - if #missing > 0 then - vim.notify( - "mini.pick: optional tools missing, related pickers will warn on use: " - .. table.concat(missing, ", "), - vim.log.levels.WARN - ) - end - end) - end, - -- stylua: ignore - -- Keymap scheme MIRRORS LazyVim's published layout (lhs + desc ported - -- from extras/editor/telescope.lua) so muscle memory and LazyVim's - -- cheatsheet still apply; only the RHS is swapped to mini.pick/extra. - keys = { - -- files (LazyVim: and ff both find files) - { "", function() require("mini.pick").builtin.files() end, desc = "Find Files" }, - { "ff", function() require("mini.pick").builtin.files() end, desc = "Find Files" }, - { "fb", function() require("mini.pick").builtin.buffers() end, desc = "Buffers" }, - { "fr", function() require("mini.extra").pickers.oldfiles() end, desc = "Recent Files" }, - -- grep (LazyVim: / and sg both live-grep) -- guarded on rg - { "/", guard("rg", "live grep", function() require("mini.pick").builtin.grep_live() end), desc = "Grep (root)" }, - { "sg", guard("rg", "live grep", function() require("mini.pick").builtin.grep_live() end), desc = "Grep (root)" }, - -- search group (no external tool) - { "sk", function() require("mini.extra").pickers.keymaps() end, desc = "Keymaps" }, - { "sh", function() require("mini.pick").builtin.help() end, desc = "Help Pages" }, - { "sR", function() require("mini.pick").builtin.resume() end, desc = "Resume" }, - { "sm", function() require("mini.extra").pickers.marks() end, desc = "Jump to Mark" }, - { "sd", function() require("mini.extra").pickers.diagnostic({ scope = "current" }) end, desc = "Document Diagnostics" }, - { "sD", function() require("mini.extra").pickers.diagnostic({ scope = "all" }) end, desc = "Workspace Diagnostics" }, - { "ss", function() require("mini.extra").pickers.lsp({ scope = "document_symbol" }) end, desc = "Goto Symbol" }, - { "sS", function() require("mini.extra").pickers.lsp({ scope = "workspace_symbol" }) end, desc = "Goto Symbol (Workspace)" }, - -- git (LazyVim: gc commits, gs status) -- guarded on git - { "gc", guard("git", "git commits", function() require("mini.extra").pickers.git_commits() end), desc = "Git Commits" }, - { "gs", guard("git", "git status", function() require("mini.extra").pickers.git_files({ scope = "modified" }) end), desc = "Git Status" }, - -- colorscheme (LazyVim: uC) -- mini has no builtin; small custom source - { "uC", function() - require("mini.pick").start({ source = { - name = "Colorschemes", - items = vim.fn.getcompletion("", "color"), - choose = function(item) vim.cmd.colorscheme(item) end, - } }) - end, desc = "Colorscheme" }, - }, - }, -}