mirror of
https://github.com/prdlk/dotfiles.git
synced 2026-11-02 19:32:43 +00:00
11 lines
329 B
Bash
11 lines
329 B
Bash
# yazi wrapper: cd to the directory yazi was left in on exit.
|
|||
|
|
yy() {
|
||
|
|
local tmp cwd
|
||
|
|
tmp=$(mktemp -t "yazi-cwd.XXXXXX")
|
||
|
|
command yazi "$@" --cwd-file="$tmp"
|
||
|
|
cwd=$(cat -- "$tmp" 2>/dev/null)
|
||
|
|
if [ -n "$cwd" ] && [ "$cwd" != "$PWD" ] && [ -d "$cwd" ]; then
|
||
|
|
builtin cd -- "$cwd"
|
||
|
|
fi
|
||
|
|
rm -f -- "$tmp"
|
||
|
|
}
|