From 2d2bf87c041ca27dae5730e72ca4257e2c64fc1f Mon Sep 17 00:00:00 2001 From: Samir Benmendil Date: Sat, 15 Feb 2025 16:30:19 +0000 Subject: [PATCH 1/1] lazyvim: remove pick util --- nvim/lua/plugins/picker.lua | 37 +++++++------------------------------ 1 file changed, 7 insertions(+), 30 deletions(-) diff --git a/nvim/lua/plugins/picker.lua b/nvim/lua/plugins/picker.lua index ca35c5d..347804f 100644 --- a/nvim/lua/plugins/picker.lua +++ b/nvim/lua/plugins/picker.lua @@ -1,23 +1,3 @@ -vim.g.lazyvim_picker = "snacks" - ----@type LazyPicker -local picker = { - name = "snacks", - commands = { - files = "files", - live_grep = "grep", - oldfiles = "recent", - }, - ---@param source string - ---@param opts? snacks.picker.Config - open = function(source, opts) - return Snacks.picker.pick(source, opts) - end, -} - -if not LazyVim.pick.register(picker) then - return {} -end ---@type LazySpec return { desc = "Fast and modern file picker", @@ -39,18 +19,17 @@ return { -- stylua: ignore keys = { { ",", function() Snacks.picker.buffers() end, desc = "Buffers" }, - { "/", LazyVim.pick("grep"), desc = "Grep (Root Dir)" }, + { "/", function() Snacks.picker.grep() end, desc = "Grep" }, { ":", function() Snacks.picker.command_history() end, desc = "Command History" }, - -- { "", LazyVim.pick("files"), desc = "Find Files (Root Dir)" }, { "n", function() Snacks.picker.notifications() end, desc = "Notification History" }, -- find { "fb", function() Snacks.picker.buffers() end, desc = "Buffers" }, { "fB", function() Snacks.picker.buffers({ hidden = true, nofile = true }) end, desc = "Buffers (all)" }, - { "fc", LazyVim.pick.config_files(), desc = "Find Config File" }, - -- { "ff", LazyVim.pick("files"), desc = "Find Files (Root Dir)" }, - { "fF", LazyVim.pick("files", { root = false }), desc = "Find Files (cwd)" }, + { "fc", function() Snacks.picker.files({ cwd = vim.fn.stdpath("config") }) end, desc = "Find Config File" }, + { "fF", function() Snacks.picker.files() end, desc = "Find Files" }, { "fg", function() Snacks.picker.git_files() end, desc = "Find Files (git-files)" }, - { "fr", LazyVim.pick("oldfiles"), desc = "Recent" }, + -- TODO: swap fr and fR ? + { "fr", function() Snacks.picker.recent() end, desc = "Recent" }, { "fR", function() Snacks.picker.recent({ filter = { cwd = true }}) end, desc = "Recent (cwd)" }, { "fp", function() Snacks.picker.projects() end, desc = "Projects" }, -- git @@ -60,11 +39,9 @@ return { -- Grep { "sb", function() Snacks.picker.lines() end, desc = "Buffer Lines" }, { "sB", function() Snacks.picker.grep_buffers() end, desc = "Grep Open Buffers" }, - { "sg", LazyVim.pick("live_grep"), desc = "Grep (Root Dir)" }, - { "sG", LazyVim.pick("live_grep", { root = false }), desc = "Grep (cwd)" }, + { "sg", function() Snacks.picker.grep() end, desc = "Grep" }, { "sp", function() Snacks.picker.lazy() end, desc = "Search for Plugin Spec" }, - { "sw", LazyVim.pick("grep_word"), desc = "Visual selection or word (Root Dir)", mode = { "n", "x" } }, - { "sW", LazyVim.pick("grep_word", { root = false }), desc = "Visual selection or word (cwd)", mode = { "n", "x" } }, + { "sw", function() Snacks.picker.grep_word() end, desc = "Visual selection or word", mode = { "n", "x" } }, -- search { 's"', function() Snacks.picker.registers() end, desc = "Registers" }, { "sa", function() Snacks.picker.autocmds() end, desc = "Autocmds" }, -- 2.48.1