diff --git a/fish/config.fish b/fish/config.fish index 78589b1..cf0aed7 100644 --- a/fish/config.fish +++ b/fish/config.fish @@ -49,5 +49,14 @@ if status is-interactive echo -en "\e]133;A\e\\" end + function y + set tmp (mktemp -t "yazi-cwd.XXXXXX") + yazi $argv --cwd-file="$tmp" + if read -z cwd <"$tmp"; and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ] + builtin cd -- "$cwd" + end + rm -f -- "$tmp" + end + bind \cz 'fg 2>/dev/null; commandline -f repaint' end diff --git a/helix/config.toml b/helix/config.toml index 3403db3..3c07710 100644 --- a/helix/config.toml +++ b/helix/config.toml @@ -6,9 +6,11 @@ render = true [keys.normal.space] e = [ ':sh rm -f /tmp/unique-file', - ':insert-output yazi %{buffer_name} --chooser-file=/tmp/unique-file', + ':sh rm -f /tmp/unique-cwd-file', + ":insert-output yazi --chooser-file=/tmp/unique-file --cwd-file=/tmp/unique-cwd-file", ':insert-output echo "\x1b[?1049h\x1b[?2004h" > /dev/tty', ':open %sh{cat /tmp/unique-file}', + ':cd %sh{cat /tmp/unique-cwd-file}', ':redraw', ]