1
0
Fork 0

Zsh: Rename hook functions, use add-zsh-hook

New format: _my_<name>_<hook>
This commit is contained in:
tastytea 2022-03-23 23:31:23 +01:00
parent 6cac28b246
commit 407391880b
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM
2 changed files with 5 additions and 8 deletions

View File

@ -130,16 +130,16 @@ case ${TERM} in
DISABLE_AUTO_TITLE="true"
# Write some info to terminal title.
# 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"
}
precmd_functions+=precmd_title
add-zsh-hook precmd _my_title_precmd
# Write command and args to terminal title.
# 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 %~)"
}
preexec_functions+=preexec_title
add-zsh-hook preexec _my_title_preexec
# # Enable TrueColor.
# if [[ "${COLORTERM}" = "truecolor" || "${TERM}" =~ "24bit" ]]; then
@ -187,10 +187,6 @@ case $(hostname) in
;;
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}"/zaliases ]] && source "${ZDOTDIR}"/zaliases
[[ -d "${ZDOTDIR}"/functions ]] && autoload -Uz "${ZDOTDIR}"/functions/*

View File

@ -69,6 +69,7 @@ function async_vcs_prompt()
}
_my_vcs_async_start
autoload -Uz add-zsh-hook
add-zsh-hook precmd _my_vcs_precmd
add-zsh-hook chpwd _my_vcs_chpwd
}