feat(picker.projects): projects now automatically processes dev folders and added a bunch of actions/keymaps. Closes #871

This commit is contained in:
Folke Lemaitre 2025-02-02 16:09:00 +01:00
parent 287db30ed2
commit 6f8f0d3c72
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
7 changed files with 105 additions and 16 deletions

View file

@ -158,6 +158,40 @@ function M.toggle_preview(picker)
picker:toggle_preview()
end
function M.picker_grep(_, item)
if item then
Snacks.picker.grep({ cwd = Snacks.picker.util.dir(item) })
end
end
function M.cd(_, item)
if item then
vim.fn.chdir(Snacks.picker.util.dir(item))
end
end
function M.picker_files(_, item)
if item then
Snacks.picker.files({ cwd = Snacks.picker.util.dir(item) })
end
end
function M.picker_explorer(_, item)
if item then
local p = Snacks.picker.get({ source = "explorer" })[1]
if p then
p:close()
end
Snacks.picker.explorer({ cwd = Snacks.picker.util.dir(item) })
end
end
function M.picker_recent(_, item)
if item then
Snacks.picker.recent({ filter = { cwd = Snacks.picker.util.dir(item) } })
end
end
function M.pick_win(picker, item, action)
if not picker.layout.split then
picker.layout:hide()
@ -353,9 +387,8 @@ function M.search(picker, item)
end
--- Tries to load the session, if it fails, it will open the picker.
function M.load_session(picker)
function M.load_session(picker, item)
picker:close()
local item = picker:current()
if not item then
return
end