summaryrefslogtreecommitdiff
path: root/dot-bashrc
diff options
context:
space:
mode:
authorJosé Juan Loeza Sierra <jj@jlsd9.com>2026-02-21 14:25:55 -0800
committerJosé Juan Loeza Sierra <jj@jlsd9.com>2026-02-21 14:25:55 -0800
commitc718d12630d9c8aa80d8e953eb992bf98707e460 (patch)
treef28b2fc0b1db16d2c981f6ccf595cc83998a65e8 /dot-bashrc
parent8b563a0d8e55f78647f8ee725fde1c4ff6da9e62 (diff)
add yazi wrapper
Diffstat (limited to 'dot-bashrc')
-rw-r--r--dot-bashrc11
1 files changed, 11 insertions, 0 deletions
diff --git a/dot-bashrc b/dot-bashrc
index 3df8ad2..13d57f1 100644
--- a/dot-bashrc
+++ b/dot-bashrc
@@ -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"
+}