diff --git a/.config/fish/config.fish b/.config/fish/config.fish index 9a6e418..c392077 100644 --- a/.config/fish/config.fish +++ b/.config/fish/config.fish @@ -32,3 +32,13 @@ set --export PATH $BUN_INSTALL/bin $PATH # opencode fish_add_path /home/alex/.opencode/bin + +# Yazi wrapper that keeps the shell in its selected directory. +function y + set tmp (mktemp -t "yazi-cwd.XXXXXX") + command yazi $argv --cwd-file="$tmp" + if read -z cwd <"$tmp"; and [ "$cwd" != "$PWD" ]; and test -d "$cwd" + builtin cd -- "$cwd" + end + command rm -f -- "$tmp" +end