nixos-config/modules/home/shell-conf/fish/functions/y.fish

11 lines
231 B
Fish
Raw Normal View History

#!/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