1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-30 06:59:45 +01:00

yazi: pass additional args to ya alias

This allows commands like `ya /etc/nixos` and `ya --help` to be used.

(cherry picked from commit abdc82d930)
This commit is contained in:
Ryan 2023-12-16 07:07:57 +08:00 committed by Robert Helgesson
parent d384a0d524
commit c8a8852b0a
No known key found for this signature in database
GPG key ID: 96E745BD17AA17ED
5 changed files with 9 additions and 9 deletions

View file

@ -9,7 +9,7 @@ let
bashIntegration = '' bashIntegration = ''
function ya() { function ya() {
tmp="$(mktemp -t "yazi-cwd.XXXXX")" tmp="$(mktemp -t "yazi-cwd.XXXXX")"
yazi --cwd-file="$tmp" yazi "$@" --cwd-file="$tmp"
if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
cd -- "$cwd" cd -- "$cwd"
fi fi
@ -20,7 +20,7 @@ let
fishIntegration = '' fishIntegration = ''
function ya function ya
set tmp (mktemp -t "yazi-cwd.XXXXX") set tmp (mktemp -t "yazi-cwd.XXXXX")
yazi --cwd-file="$tmp" yazi $argv --cwd-file="$tmp"
if set cwd (cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ] if set cwd (cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ]
cd -- "$cwd" cd -- "$cwd"
end end
@ -29,9 +29,9 @@ let
''; '';
nushellIntegration = '' nushellIntegration = ''
def --env ya [] { def --env ya [args?] {
let tmp = $"($env.TEMP)(char path_sep)yazi-cwd." + (random chars -l 5) let tmp = $"($env.TEMP)(char path_sep)yazi-cwd." + (random chars -l 5)
yazi --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

@ -4,7 +4,7 @@ let
shellIntegration = '' shellIntegration = ''
function ya() { function ya() {
tmp="$(mktemp -t "yazi-cwd.XXXXX")" tmp="$(mktemp -t "yazi-cwd.XXXXX")"
yazi --cwd-file="$tmp" yazi "$@" --cwd-file="$tmp"
if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
cd -- "$cwd" cd -- "$cwd"
fi fi

View file

@ -4,7 +4,7 @@ let
shellIntegration = '' shellIntegration = ''
function ya function ya
set tmp (mktemp -t "yazi-cwd.XXXXX") set tmp (mktemp -t "yazi-cwd.XXXXX")
yazi --cwd-file="$tmp" yazi $argv --cwd-file="$tmp"
if set cwd (cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ] if set cwd (cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ]
cd -- "$cwd" cd -- "$cwd"
end end

View file

@ -2,9 +2,9 @@
let let
shellIntegration = '' shellIntegration = ''
def --env ya [] { def --env ya [args?] {
let tmp = $"($env.TEMP)(char path_sep)yazi-cwd." + (random chars -l 5) let tmp = $"($env.TEMP)(char path_sep)yazi-cwd." + (random chars -l 5)
yazi --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

@ -4,7 +4,7 @@ let
shellIntegration = '' shellIntegration = ''
function ya() { function ya() {
tmp="$(mktemp -t "yazi-cwd.XXXXX")" tmp="$(mktemp -t "yazi-cwd.XXXXX")"
yazi --cwd-file="$tmp" yazi "$@" --cwd-file="$tmp"
if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
cd -- "$cwd" cd -- "$cwd"
fi fi