Skip to content

Commit

Permalink
docs: simplify shell wrapper function name further
Browse files Browse the repository at this point in the history
  • Loading branch information
sxyazi committed Sep 7, 2024
1 parent 065cbba commit 29af4e2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
9 changes: 4 additions & 5 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ You can also manage Yazi's configuration using [home-manager](https://nix-commun

```nix
{pkgs, ...}: let
plugins-repo = pkgs.fetchFromGitHub {
yazi-plugins = pkgs.fetchFromGitHub {
owner = "yazi-rs";
repo = "plugins";
rev = "...";
Expand All @@ -101,9 +101,9 @@ in {
};
plugins = {
chmod = "${plugins-repo}/chmod.yazi";
full-border = "${plugins-repo}/full-border.yazi";
max-preview = "${plugins-repo}/max-preview.yazi";
chmod = "${yazi-plugins}/chmod.yazi";
full-border = "${yazi-plugins}/full-border.yazi";
max-preview = "${yazi-plugins}/max-preview.yazi";
starship = pkgs.fetchFromGitHub {
owner = "Rolv-Apneseth";
repo = "starship.yazi";
Expand Down Expand Up @@ -333,4 +333,3 @@ If it fails to build, please check if `make` and `gcc` is installed on your syst
```sh
x env use yazi fzf 7za jq fd rg zoxide
```

14 changes: 7 additions & 7 deletions docs/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ Press <kbd>q</kbd> to quit and <kbd>~</kbd> to open the help menu.

## Shell wrapper

We suggest using this `yy` shell wrapper that provides the ability to change the current working directory when exiting Yazi.
We suggest using this `y` shell wrapper that provides the ability to change the current working directory when exiting Yazi.

<Tabs>
<TabItem value="bash-zsh" label="Bash / Zsh" default>

```bash
function yy() {
function y() {
local tmp="$(mktemp -t "yazi-cwd.XXXXXX")"
yazi "$@" --cwd-file="$tmp"
if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
Expand All @@ -38,7 +38,7 @@ function yy() {
<TabItem value="fish" label="Fish">

```sh
function yy
function y
set tmp (mktemp -t "yazi-cwd.XXXXXX")
yazi $argv --cwd-file="$tmp"
if set cwd (command cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ]
Expand All @@ -52,7 +52,7 @@ end
<TabItem value="nushell" label="Nushell">
```sh
def --env yy [...args] {
def --env y [...args] {
let tmp = (mktemp -t "yazi-cwd.XXXXXX")
yazi ...$args --cwd-file $tmp
let cwd = (open $tmp)
Expand All @@ -67,7 +67,7 @@ def --env yy [...args] {
<TabItem value="powershell" label="PowerShell">
```powershell
function yy {
function y {
$tmp = [System.IO.Path]::GetTempFileName()
yazi $args --cwd-file="$tmp"
$cwd = Get-Content -Path $tmp
Expand All @@ -81,7 +81,7 @@ function yy {
</TabItem>
<TabItem value="command-prompt" label="Command Prompt">
Create the file `yy.cmd` and place it in your `%PATH%`.
Create the file `y.cmd` and place it in your `%PATH%`.
```cmd
@echo off
Expand All @@ -102,7 +102,7 @@ del "%tmpfile%"
</TabItem>
</Tabs>
To use it, copy the function into the configuration file of your respective shell. Then use `yy` instead of `yazi` to start.
To use it, copy the function into the configuration file of your respective shell. Then use `y` instead of `yazi` to start.
## Keybindings
Expand Down

0 comments on commit 29af4e2

Please sign in to comment.