fix(picker.actions): <c-g> in list view now prints file path instead of cwd. Fallback to cwd

This commit is contained in:
Folke Lemaitre 2025-10-21 08:18:33 +02:00
parent 58448e02f5
commit 0b0a58ae4a
No known key found for this signature in database
GPG key ID: 9B52594D560070AB
2 changed files with 11 additions and 2 deletions

View file

@ -154,7 +154,16 @@ function M.close(picker)
end
function M.print_cwd(picker)
print(picker:cwd())
print(vim.fn.fnamemodify(picker:cwd(), ":p:~"))
end
function M.print_dir(picker)
print(vim.fn.fnamemodify(picker:dir(), ":p:~"))
end
function M.print_path(picker, item)
local path = item and Snacks.picker.util.path(item) or picker:dir()
print(vim.fn.fnamemodify(path, ":p:~"))
end
function M.cancel(picker)

View file

@ -291,7 +291,7 @@ local defaults = {
["<c-n>"] = "list_down",
["<c-p>"] = "list_up",
["<c-q>"] = "qflist",
["<c-g>"] = "print_cwd",
["<c-g>"] = "print_path",
["<c-s>"] = "edit_split",
["<c-t>"] = "tab",
["<c-u>"] = "list_scroll_up",