Add terminal title to prompt function

This commit is contained in:
Adam Goldsmith 2016-02-15 11:15:04 -05:00
parent c1e4943e23
commit 4042b68e9b

View File

@ -54,6 +54,14 @@ function prompt_fred_precmd {
(( PWDWIDTH = ($COLUMNS-20) * 1/4 )) (( PWDWIDTH = ($COLUMNS-20) * 1/4 ))
vcs_info vcs_info
#Terminal Title
print -Pn "\e]0;%~:zsh\a"
}
function prompt_fred_preexec {
#Terminal Title
print -Pn '\e]0;%~:${1}\a'
} }
function prompt_fred_setup { function prompt_fred_setup {
@ -72,6 +80,7 @@ function prompt_fred_setup {
# Add hook for calling precmd before each command. # Add hook for calling precmd before each command.
add-zsh-hook precmd prompt_fred_precmd add-zsh-hook precmd prompt_fred_precmd
add-zsh-hook preexec prompt_fred_preexec
# Define prompts. # Define prompts.
PROMPT='$(prompt_context)%F{cyan} %${PWDWIDTH}<..<%~%f$(prompt_git)$(prompt_prefix)' PROMPT='$(prompt_context)%F{cyan} %${PWDWIDTH}<..<%~%f$(prompt_git)$(prompt_prefix)'