From f242e9d37de0c62930cc763980c8c5511221ea89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Uruba?= Date: Wed, 8 Oct 2025 20:17:19 +0200 Subject: [PATCH] nvim: Grep directory in snacks.nvim --- .../lazy-plugins/collection-snacks-nvim.lua | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/nvim/.config/nvim/lua/lazy-plugins/collection-snacks-nvim.lua b/nvim/.config/nvim/lua/lazy-plugins/collection-snacks-nvim.lua index 1ccf6c3..aa8b784 100644 --- a/nvim/.config/nvim/lua/lazy-plugins/collection-snacks-nvim.lua +++ b/nvim/.config/nvim/lua/lazy-plugins/collection-snacks-nvim.lua @@ -75,6 +75,29 @@ return { end, desc = "Grep", }, + { + "\\", + function() + -- Get a list of all directories in the workspace + local workspace_path = vim.fn.getcwd() + local directories = vim.fn.systemlist("find " .. workspace_path .. " -type d") + + -- Present the directories to the user for selection + vim.ui.select(directories, { + prompt = "Select a directory:", + format_item = function(item) + return item + end, + }, function(choice) + if choice then + Snacks.picker.grep({ dirs = { choice } }) + else + print("No directory selected") + end + end) + end, + desc = "Grep", + }, { ":", function()