diff options
| author | José Juan Loeza Sierra <jj@jlsd9.com> | 2026-02-21 14:25:55 -0800 |
|---|---|---|
| committer | José Juan Loeza Sierra <jj@jlsd9.com> | 2026-02-21 14:25:55 -0800 |
| commit | c718d12630d9c8aa80d8e953eb992bf98707e460 (patch) | |
| tree | f28b2fc0b1db16d2c981f6ccf595cc83998a65e8 | |
| parent | 8b563a0d8e55f78647f8ee725fde1c4ff6da9e62 (diff) | |
add yazi wrapper
| -rw-r--r-- | dot-bashrc | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -119,3 +119,14 @@ osc7_cwd() { printf '\e]7;file://%s%s\e\\' "${HOSTNAME}" "${encoded}" } PROMPT_COMMAND=${PROMPT_COMMAND:+${PROMPT_COMMAND%;}; }osc7_cwd + +# Use `y` as a shell wrapper for Yazi +# Provides ability to change the cwd when exiting Yazi +# See https://yazi-rs.github.io/docs/quick-start/#shell-wrapper +function y() { + local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" cwd + command yazi "$@" --cwd-file="$tmp" + IFS= read -r -d '' cwd < "$tmp" + [ "$cwd" != "$PWD" ] && [ -d "$cwd" ] && builtin cd -- "$cwd" + /usr/bin/rm -f -- "$tmp" +} |
