From f30bf8a3bd338cff038279eb92bd9c28b8eb2f4f Mon Sep 17 00:00:00 2001 From: Alex Blank Date: Thu, 13 Aug 2026 15:49:47 +0200 Subject: [PATCH] feat(fish): preserve directory after Yazi exits Add the standard cwd-file wrapper so Yazi navigation updates the interactive shell directory. --- .config/fish/config.fish | 10 ++++++++++ 1 file changed, 10 insertions(+) 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