yazi: fix nushell integration

This commit is contained in:
XYenon 2024-01-04 03:18:53 +08:00 committed by GitHub
parent f772334b35
commit 992b38f29c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 4 deletions

View file

@ -30,8 +30,12 @@ let
nushellIntegration = '' nushellIntegration = ''
def --env ya [args?] { def --env ya [args?] {
let tmp = $"($env.TEMP)(char path_sep)yazi-cwd." + (random chars -l 5) let tmp = (mktemp -t "yazi-cwd.XXXXX")
if ($args == null) {
yazi --cwd-file $tmp
} else {
yazi $args --cwd-file $tmp yazi $args --cwd-file $tmp
}
let cwd = (open $tmp) let cwd = (open $tmp)
if $cwd != "" and $cwd != $env.PWD { if $cwd != "" and $cwd != $env.PWD {
cd $cwd cd $cwd

View file

@ -3,8 +3,12 @@
let let
shellIntegration = '' shellIntegration = ''
def --env ya [args?] { def --env ya [args?] {
let tmp = $"($env.TEMP)(char path_sep)yazi-cwd." + (random chars -l 5) let tmp = (mktemp -t "yazi-cwd.XXXXX")
if ($args == null) {
yazi --cwd-file $tmp
} else {
yazi $args --cwd-file $tmp yazi $args --cwd-file $tmp
}
let cwd = (open $tmp) let cwd = (open $tmp)
if $cwd != "" and $cwd != $env.PWD { if $cwd != "" and $cwd != $env.PWD {
cd $cwd cd $cwd