addet yazi 'y' function

This commit is contained in:
pik4li 2024-12-25 10:07:18 +01:00
parent 2ef1ba0f33
commit 24ec2d6925

10
.zshrc
View file

@ -119,7 +119,7 @@ HISTDUP=erase
# Completion styling
zstyle :compinstall filename "$HOME/.zshrc"
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
# zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
zstyle ':completion:*' menu no
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'ls --color $realpath'
zstyle ':fzf-tab:complete:__zoxide_z:*' fzf-preview 'ls --color $realpath'
@ -218,6 +218,14 @@ _alias(){
if command_exists yazi; then
echo_info "yazi is the explorer of choise"
alias lf="yazi || ya pack -i"
function y() {
local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" cwd
yazi "$@" --cwd-file="$tmp"
if cwd="$(command cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
builtin cd -- "$cwd"
fi
rm -f -- "$tmp"
}
elif command_exists ranger; then
echo_info "ranger is the explorer of choise"
alias lf="ranger"