Skip to content

Commit

Permalink
Use add-zsh-hook for dynamic dir naming
Browse files Browse the repository at this point in the history
  • Loading branch information
marlonrichert committed Mar 9, 2021
1 parent 68b7c64 commit e1e94b6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions functions/:znap:init
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ zmodload -Fa zsh/files b:zf_mkdir b:zf_rm
autoload -Uz add-zsh-hook

if zstyle -T :znap: auto-compile; then
zmodload -Fa zsh/parameter p:funcstack
() {
setopt localoptions NO_warncreateglobal
zmodload -Fa zsh/parameter p:funcstack
}

source . () {
builtin $0 "$@"; local -i ret=$?
Expand All @@ -13,10 +16,7 @@ if zstyle -T :znap: auto-compile; then
add-zsh-hook preexec :znap:auto-compile
fi

export -U zsh_directory_name_functions=(
:znap:dirname
$zsh_directory_name_functions[@]
)
add-zsh-hook zsh_directory_name :znap:dirname

export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}"
[[ ! -d $XDG_CACHE_HOME/zsh ]] &&
Expand Down

0 comments on commit e1e94b6

Please sign in to comment.