From a462e7315deaa8194b0821f726709bb7e51a850c Mon Sep 17 00:00:00 2001 From: XYenon Date: Sat, 25 Nov 2023 16:17:54 +0800 Subject: [PATCH] yazi: update shell integrations and docs --- modules/programs/yazi.nix | 14 +++++++------- .../programs/yazi/fish-integration-enabled.nix | 2 +- .../programs/yazi/nushell-integration-enabled.nix | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/modules/programs/yazi.nix b/modules/programs/yazi.nix index 3dc167bc..1f1f5bb4 100644 --- a/modules/programs/yazi.nix +++ b/modules/programs/yazi.nix @@ -21,7 +21,7 @@ let function ya set tmp (mktemp -t "yazi-cwd.XXXXX") yazi --cwd-file="$tmp" - if set cwd (cat -- "$tmp") && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ] + if set cwd (cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ] cd -- "$cwd" end rm -f -- "$tmp" @@ -29,10 +29,10 @@ let ''; nushellIntegration = '' - def-env ya [] { - let tmp = (mktemp -t "yazi-cwd.XXXXX") + def --env ya [] { + let tmp = $"($env.TEMP)(char path_sep)yazi-cwd." + (random chars -l 5) yazi --cwd-file $tmp - let cwd = (cat -- $tmp) + let cwd = (open $tmp) if $cwd != "" and $cwd != $env.PWD { cd $cwd } @@ -82,7 +82,7 @@ in { Configuration written to {file}`$XDG_CONFIG_HOME/yazi/keymap.toml`. - See + See for the full list of options. ''; }; @@ -107,7 +107,7 @@ in { Configuration written to {file}`$XDG_CONFIG_HOME/yazi/yazi.toml`. - See + See for the full list of options. ''; }; @@ -131,7 +131,7 @@ in { Configuration written to {file}`$XDG_CONFIG_HOME/yazi/theme.toml`. - See + See for the full list of options ''; }; diff --git a/tests/modules/programs/yazi/fish-integration-enabled.nix b/tests/modules/programs/yazi/fish-integration-enabled.nix index 5568f5b5..155684d5 100644 --- a/tests/modules/programs/yazi/fish-integration-enabled.nix +++ b/tests/modules/programs/yazi/fish-integration-enabled.nix @@ -5,7 +5,7 @@ let function ya set tmp (mktemp -t "yazi-cwd.XXXXX") yazi --cwd-file="$tmp" - if set cwd (cat -- "$tmp") && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ] + if set cwd (cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ] cd -- "$cwd" end rm -f -- "$tmp" diff --git a/tests/modules/programs/yazi/nushell-integration-enabled.nix b/tests/modules/programs/yazi/nushell-integration-enabled.nix index d12f747f..7b353228 100644 --- a/tests/modules/programs/yazi/nushell-integration-enabled.nix +++ b/tests/modules/programs/yazi/nushell-integration-enabled.nix @@ -2,10 +2,10 @@ let shellIntegration = '' - def-env ya [] { - let tmp = (mktemp -t "yazi-cwd.XXXXX") + def --env ya [] { + let tmp = $"($env.TEMP)(char path_sep)yazi-cwd." + (random chars -l 5) yazi --cwd-file $tmp - let cwd = (cat -- $tmp) + let cwd = (open $tmp) if $cwd != "" and $cwd != $env.PWD { cd $cwd }