diff --git a/.zshrc b/.zshrc index 64efcc2..b72ab68 100644 --- a/.zshrc +++ b/.zshrc @@ -88,14 +88,14 @@ zinit ice as"command" from"gh-r" \ atpull"%atclone" src"init.zsh" zinit light starship/starship -# async dotfiles pull (once/day, after prompt) -zinit ice wait'1' silent nocompile atload' +# async dotfiles pull (once/day) +{ + sleep 1 local marker=~/.cache/.dotfiles-pull [[ -f $marker && $(($(date +%s) - $(stat -c %Y $marker))) -lt 86400 ]] && return mkdir -p ~/.cache && touch $marker git --git-dir=$HOME/.dotgit/ --work-tree=$HOME pull --ff-only -q 2>/dev/null -' -zinit light zdharma-continuum/null +} &! # paths typeset -U path @@ -138,6 +138,15 @@ alias tmuxr="tmux new-session -A -s auto" alias tmuxn="tmux new-session -A -s auto \; new-window" alias tmuxa="tmux new-session -A -s" +# yazi wrapper (cd to dir on exit) +function y() { + local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" cwd + command yazi "$@" --cwd-file="$tmp" + IFS= read -r -d '' cwd < "$tmp" + [ "$cwd" != "$PWD" ] && [ -d "$cwd" ] && builtin cd -- "$cwd" + rm -f -- "$tmp" +} + # aliases: misc alias zshreload="exec zsh" alias -g LATEST='*(om[1])' # glob: most recently modified