From 6951860d8547a7bab1b6fbb186deef5b20a9a263 Mon Sep 17 00:00:00 2001 From: fhchl Date: Wed, 15 Jan 2025 12:04:18 +0100 Subject: [PATCH] docs: add `y` function for Xonsh (#197) --- docs/quick-start.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/quick-start.md b/docs/quick-start.md index 8cd40942..85771b91 100644 --- a/docs/quick-start.md +++ b/docs/quick-start.md @@ -116,6 +116,23 @@ if not "%cwd%"=="" ( ) del "%tmpfile%" +``` + + + + +```xonsh +def _y(args): + tmp = $(mktemp -t "yazi-cwd.XXXXXX") + args.append(f"--cwd-file={tmp}") + $[yazi @(args)] + with open(tmp) as f: + cwd = f.read().strip() + if cwd != $PWD: + cd @(cwd) + rm -f -- @(tmp) + +aliases["y"] = _y ```