feat: y function to preserve navigation from yazi

This commit is contained in:
2026-06-21 18:50:36 +02:00
parent 222191485a
commit 8685ff0c51
+8
View File
@@ -136,3 +136,11 @@ done
alias arty="arty.sh"
alias stacks="stacks.sh"
type bat >/dev/null 2>&1 && alias cat="bat --paging=never"
function y() {
local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" cwd
command yazi "$@" --cwd-file="$tmp"
IFS= read -r -d '' cwd < "$tmp"
[ "$cwd" != "$PWD" ] && [ -d "$cwd" ] && builtin cd -- "$cwd"
command rm -f -- "$tmp"
}