How to change current directory of shell to selected directory in yazi upon exiting? #1034
Replies: 5 comments 3 replies
-
Hm, it should just work. Unfortunately, the suggestions I can think of are very basic. Like, making sure you:
edit: improve the clarity |
Beta Was this translation helpful? Give feedback.
-
i am using zsh (in function yy() {
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"
}
Calling |
Beta Was this translation helpful? Give feedback.
-
It doesnt work for me neither. I have copied the same from Quickstart and added to my zshrc |
Beta Was this translation helpful? Give feedback.
-
@sxyazi |
Beta Was this translation helpful? Give feedback.
-
If anyone's looking for a version that works in fish: function yy
set -l tmp (mktemp -t "yazi-cwd.XXXXXX")
yazi $argv --cwd-file=$tmp
set cwd (cat -- $tmp)
if test -s $tmp
if test -n "$cwd" -a "$cwd" != "$PWD"
cd -- $cwd
commandline -f repaint # updates the prompt
end
end
rm -f -- $tmp
end Edit: added line to update the prompt |
Beta Was this translation helpful? Give feedback.
-
I've tried the function that is given on the website quick start:
but that doesn't seem to work when I use
q
orQ
to exit the explorer. Is there something else that I should be doing to make this work?Beta Was this translation helpful? Give feedback.
All reactions