Zsh: Rename hook functions, use add-zsh-hook
New format: _my_<name>_<hook>
This commit is contained in:
parent
6cac28b246
commit
407391880b
|
@ -130,16 +130,16 @@ case ${TERM} in
|
||||||
DISABLE_AUTO_TITLE="true"
|
DISABLE_AUTO_TITLE="true"
|
||||||
# Write some info to terminal title.
|
# Write some info to terminal title.
|
||||||
# This is seen when the shell prompts for input.
|
# This is seen when the shell prompts for input.
|
||||||
function precmd_title {
|
function _my_title_precmd() {
|
||||||
print -Pn "\e]0;%m: %(1j,%j job%(2j|s|); ,)%~\a"
|
print -Pn "\e]0;%m: %(1j,%j job%(2j|s|); ,)%~\a"
|
||||||
}
|
}
|
||||||
precmd_functions+=precmd_title
|
add-zsh-hook precmd _my_title_precmd
|
||||||
# Write command and args to terminal title.
|
# Write command and args to terminal title.
|
||||||
# This is seen while the shell waits for a command to complete.
|
# This is seen while the shell waits for a command to complete.
|
||||||
function preexec_title {
|
function _my_title_preexec() {
|
||||||
printf "\e]0;%s: %s; %s\a" "${HOST}" "${1}" "$(print -Pn %~)"
|
printf "\e]0;%s: %s; %s\a" "${HOST}" "${1}" "$(print -Pn %~)"
|
||||||
}
|
}
|
||||||
preexec_functions+=preexec_title
|
add-zsh-hook preexec _my_title_preexec
|
||||||
|
|
||||||
# # Enable TrueColor.
|
# # Enable TrueColor.
|
||||||
# if [[ "${COLORTERM}" = "truecolor" || "${TERM}" =~ "24bit" ]]; then
|
# if [[ "${COLORTERM}" = "truecolor" || "${TERM}" =~ "24bit" ]]; then
|
||||||
|
@ -187,10 +187,6 @@ case $(hostname) in
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Make sure each function is only called 1 time.
|
|
||||||
precmd_functions=(${(u)precmd_functions})
|
|
||||||
preexec_functions=(${(u)preexec_functions})
|
|
||||||
|
|
||||||
[[ -f "${ZDOTDIR}"/zkeys ]] && source "${ZDOTDIR}"/zkeys
|
[[ -f "${ZDOTDIR}"/zkeys ]] && source "${ZDOTDIR}"/zkeys
|
||||||
[[ -f "${ZDOTDIR}"/zaliases ]] && source "${ZDOTDIR}"/zaliases
|
[[ -f "${ZDOTDIR}"/zaliases ]] && source "${ZDOTDIR}"/zaliases
|
||||||
[[ -d "${ZDOTDIR}"/functions ]] && autoload -Uz "${ZDOTDIR}"/functions/*
|
[[ -d "${ZDOTDIR}"/functions ]] && autoload -Uz "${ZDOTDIR}"/functions/*
|
||||||
|
|
|
@ -69,6 +69,7 @@ function async_vcs_prompt()
|
||||||
}
|
}
|
||||||
|
|
||||||
_my_vcs_async_start
|
_my_vcs_async_start
|
||||||
|
autoload -Uz add-zsh-hook
|
||||||
add-zsh-hook precmd _my_vcs_precmd
|
add-zsh-hook precmd _my_vcs_precmd
|
||||||
add-zsh-hook chpwd _my_vcs_chpwd
|
add-zsh-hook chpwd _my_vcs_chpwd
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user