-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathinit.zsh
27 lines (27 loc) · 904 Bytes
/
init.zsh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
[[ ${TERM} != dumb ]] && () {
local termtitle_format
local zhooks zhook
zstyle -a ':zim:termtitle' hooks 'zhooks' || zhooks=(precmd)
setopt prompt{percent,subst}
autoload -Uz add-zsh-hook
for zhook in ${zhooks}; do
if [[ ${TERM_PROGRAM} == Apple_Terminal ]]; then
termtitle_update_${zhook}() {
print -n "\E]7;${PWD}\a"
}
else
zstyle -s ":zim:termtitle:${zhook}" format 'termtitle_format' || \
zstyle -s ':zim:termtitle' format 'termtitle_format' || \
termtitle_format='%n@%m: %~'
case ${TERM} in
screen)
builtin eval "termtitle_update_${zhook}() { print -Pn '\Ek'${(qq)termtitle_format}'\E\\' }"
;;
*)
builtin eval "termtitle_update_${zhook}() { print -Pn '\E]0;'${(qq)termtitle_format}'\a' }"
;;
esac
fi
add-zsh-hook ${zhook} termtitle_update_${zhook}
done
}