nvim: Grep directory in snacks.nvim
This commit is contained in:
parent
a3f7e85d2b
commit
f242e9d37d
@ -75,6 +75,29 @@ return {
|
|||||||
end,
|
end,
|
||||||
desc = "Grep",
|
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>:",
|
"<leader>:",
|
||||||
function()
|
function()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user