From 7ddbea632e2681fba1d430e366ca31bf048568cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Sun, 30 Aug 2015 20:15:13 +0200 Subject: [zsh] Use add-zsh-hook wherever possible. --- .zsh/zshrc | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/.zsh/zshrc b/.zsh/zshrc index a8024e8..8f4f567 100644 --- a/.zsh/zshrc +++ b/.zsh/zshrc @@ -102,6 +102,13 @@ if [[ $- != *i* ]] ; then fi # }}} +# General ZSH Functionality {{{ +################################################# + +autoload -Uz add-zsh-hook + +# }}} + # Completion {{{ ################################################# autoload -U compinit @@ -133,6 +140,8 @@ zstyle ':completion:*:cd:*' ignore-parents parent pwd # Prompt {{{ ################################################# +add-zsh-hook -Uz precmd promptnl # always guarantee a newline + autoload -U promptinit promptinit @@ -166,7 +175,7 @@ if is-at-least 4.3.9; then zstyle ":vcs_info:*" get-revision true zstyle ":vcs_info:*" check-for-changes true zstyle ":vcs_info:*" max-exports 1 - + # hg stuff zstyle ":vcs_info:hg:*" unstagedstr '*' zstyle ":vcs_info:hg:*" hgrevformat '%r' @@ -176,12 +185,10 @@ if is-at-least 4.3.9; then zstyle ":vcs_info:bzr:*" use-simple true RPROMPT='${vcs_info_msg_0_:+"${vcs_info_msg_0_} "}'"${RPROMPT}" -else - vcs_info () {} # dummy + + add-zsh-hook precmd vcs_info fi -autoload promptnl -precmd_functions=( ${precmd_functions} promptnl vcs_info ) # }}} @@ -202,6 +209,7 @@ _set_title () { esac echo -ne "${pre}${USER}@${HOST}:${PWD/$HOME/~}${post}" } +add-zsh-hook precmd _set_title _set_cwd () { local update="\0033]777;cwd-spawn;path;$PWD\0007" @@ -215,9 +223,7 @@ _set_cwd () { echo -ne "$update" } - -precmd_functions=( ${precmd_functions} _set_title ) -chpwd_functions=( ${chpwd_functions} _set_cwd ) +add-zsh-hook chpwd _set_cwd case $TERM in xterm*) @@ -321,7 +327,7 @@ autoload -U zmv # }}} -# Cleanuo {{{ +# Cleanup {{{ ################################################# unset _IS_GENTOO -- cgit v1.2.3