nixos-config/modules/home/shell-conf/fish/functions/y.fish
2025-03-21 16:50:54 -04:00

10 lines
231 B
Fish

#!/usr/bin/env fish
function y
set tmp (mktemp -t "yazi-cwd.XXXXXX")
yazi $argv --cwd-file="$tmp"
if set cwd (command cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ]
builtin cd -- "$cwd"
end
rm -f -- "$tmp"
end