This commit is contained in:
Davide Frattarolo
2025-09-30 18:24:18 +02:00
parent cb0c0e6e6e
commit 9b167944ae
2 changed files with 41 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
function mkd --description 'Create directory(ies) and cd into the first one'
if test (count $argv) -eq 0
echo "mkd: missing operand" >&2
return 1
end
# Parse options and directories
set -l options
set -l directories
set -l first_dir
for arg in $argv
if string match -q -- '-*' $arg
set -a options $arg
else
set -a directories $arg
# Store the first directory
if test -z "$first_dir"
set first_dir $arg
end
end
end
# Create directories with all options
if test (count $directories) -gt 0
mkdir $options $directories
and cd $first_dir
else
echo "mkd: no directory specified" >&2
return 1
end
end
+9
View File
@@ -0,0 +1,9 @@
function y
set tmp (mktemp -t "yazi-cwd.XXXXXX")
yazi $argv --cwd-file="$tmp"
if read -z cwd < "$tmp"; and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ]
builtin cd -- "$cwd"
end
rm -f -- "$tmp"
end