Cd : Yazi cd to dir on exit.

This commit is contained in:
Dmitry Voronin 2024-06-22 21:43:28 +03:00
parent 416f49ed18
commit 2890c81cef
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k

View file

@ -45,7 +45,12 @@
# CLI cd. Opens CLI file manager. # CLI cd. Opens CLI file manager.
function ccd() { function ccd() {
yazi local tmp="$(mktemp -t "yazi-cwd.XXXXXX")"
yazi "$@" --cwd-file="$tmp"
if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
cd -- "$cwd"
fi
rm -f -- "$tmp"
} }
# Get list of all parent dirs. # Get list of all parent dirs.