[Fix #83] Always respect the auto-title option
This commit is contained in:
parent
070c6756a8
commit
1c4c66c448
20
terminal.zsh
20
terminal.zsh
|
@ -78,15 +78,17 @@ autoload -Uz add-zsh-hook
|
||||||
|
|
||||||
# Sets the tab and window titles before the prompt is displayed.
|
# Sets the tab and window titles before the prompt is displayed.
|
||||||
function set-title-precmd {
|
function set-title-precmd {
|
||||||
if [[ "$TERM_PROGRAM" != "Apple_Terminal" ]] && zstyle -t ':omz:terminal' auto-title; then
|
if zstyle -t ':omz:terminal' auto-title; then
|
||||||
set-window-title "${(%):-%~}"
|
if [[ "$TERM_PROGRAM" == 'Apple_Terminal' ]]; then
|
||||||
for kind in tab screen; do
|
# Set the current working directory in Apple Terminal.
|
||||||
# Left-truncate the current working directory to 15 characters.
|
printf '\e]7;%s\a' "file://$HOST${PWD// /%20}"
|
||||||
set-${kind}-title "${(%):-%15<...<%~%<<}"
|
else
|
||||||
done
|
set-window-title "${(%):-%~}"
|
||||||
else
|
for kind in tab screen; do
|
||||||
# Set Apple Terminal current working directory.
|
# Left-truncate the current working directory to 15 characters.
|
||||||
printf '\e]7;%s\a' "file://$HOST${PWD// /%20}"
|
set-${kind}-title "${(%):-%15<...<%~%<<}"
|
||||||
|
done
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
add-zsh-hook precmd set-title-precmd
|
add-zsh-hook precmd set-title-precmd
|
||||||
|
|
Loading…
Reference in a new issue