mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 18:58:12 +00:00
feat(picker.projects): projects now automatically processes dev folders and added a bunch of actions/keymaps. Closes #871
This commit is contained in:
parent
287db30ed2
commit
6f8f0d3c72
7 changed files with 105 additions and 16 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue