1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2024-07-03 12:20:27 +00:00

Set Apple Terminal current working directory.

This commit is contained in:
Sorin Ionescu 2011-10-08 22:29:26 -04:00
parent b65195156d
commit 7fa0d20d8c

View File

@ -31,6 +31,7 @@ function set-tab-title() {
fi fi
} }
# Sets the tab and window titles with the command name.
function set-title-by-command() { function set-title-by-command() {
emulate -L zsh emulate -L zsh
setopt localoptions extended_glob setopt localoptions extended_glob
@ -69,12 +70,15 @@ 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 check-bool "$AUTO_TITLE"; then if [[ "$TERM_PROGRAM" != "Apple_Terminal" ]] && check-bool "$AUTO_TITLE"; then
set-window-title "${(%):-%~}" set-window-title "${(%):-%~}"
for kind in tab screen; do for kind in tab screen; do
# Left-truncate the current working directory to 15 characters. # Left-truncate the current working directory to 15 characters.
set-${kind}-title "${(%):-%15<...<%~%<<}" set-${kind}-title "${(%):-%15<...<%~%<<}"
done done
else
# Set Apple Terminal current working directory.
printf '\e]7;%s\a' "file://$HOST${PWD// /%20}"
fi fi
} }
add-zsh-hook precmd set-title-precmd add-zsh-hook precmd set-title-precmd