Skip to content

Commit

Permalink
docs: add y function for Xonsh (#197)
Browse files Browse the repository at this point in the history
  • Loading branch information
fhchl authored Jan 15, 2025
1 parent 04b7de8 commit 6951860
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions docs/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,23 @@ if not "%cwd%"=="" (
)

del "%tmpfile%"
```
</TabItem>
<TabItem value="xonsh" label="Xonsh">
```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
```
</TabItem>
Expand Down

0 comments on commit 6951860

Please sign in to comment.