nvim: Grep directory in snacks.nvim

This commit is contained in:
Václav Uruba 2025-10-08 20:17:19 +02:00
parent a3f7e85d2b
commit f242e9d37d
Signed by: uruba
GPG Key ID: 9D8E987C4B2E1E9C

View File

@ -75,6 +75,29 @@ return {
end,
desc = "Grep",
},
{
"<leader>\\",
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",
},
{
"<leader>:",
function()