diff options
Diffstat (limited to 'mac/.config/zsh/scripts.zsh')
| -rw-r--r-- | mac/.config/zsh/scripts.zsh | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/mac/.config/zsh/scripts.zsh b/mac/.config/zsh/scripts.zsh index 7ebe2ed..a90bca5 100644 --- a/mac/.config/zsh/scripts.zsh +++ b/mac/.config/zsh/scripts.zsh @@ -474,6 +474,7 @@ function lfcd () { fi } + ########################################################################################### ########################################################################################### ### --- MAN --- ### @@ -863,3 +864,18 @@ function delete_venv() { echo "$venv deleted" fi } + + +########################################################################################### +########################################################################################### +### --- YAZI --- ### +# open yazi and cd to the file path +function yazicd () { + tmp="$(mktemp -uq)" + trap 'rm -f $tmp >/dev/null 2>&1 && trap - HUP INT QUIT TERM EXIT' HUP INT QUIT TERM EXIT + yazi --cwd-file="$tmp" "$@" + if [ -f "$tmp" ]; then + dir="$(cat "$tmp")" + [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir" + fi +} |
