Close #124 PR: Show hostname in terminal title if session is over ssh.

This commit is contained in:
Mathias Fredriksson
2015-06-01 13:27:44 +02:00
committed by Sindre Sorhus
parent df9f2ec38d
commit fbca62ea3f

View File

@@ -61,9 +61,13 @@ prompt_pure_check_git_arrows() {
prompt_pure_preexec() {
prompt_pure_cmd_timestamp=$EPOCHSECONDS
# shows the current dir and executed command in the title when a process is active
# tell the terminal we are setting the title
print -Pn "\e]0;"
echo -nE "$PWD:t: $2"
# show hostname if connected through ssh
[[ "$SSH_CONNECTION" != '' ]] && print -Pn "(%m) "
# shows the current dir and executed command in the title when a process is active
# (use print -r to disable potential evaluation of escape characters in cmd)
print -Pnr "$PWD:t: $2"
print -Pn "\a"
}
@@ -126,8 +130,12 @@ prompt_pure_precmd() {
# check for git arrows
prompt_pure_git_arrows=$(prompt_pure_check_git_arrows)
# tell the terminal we are setting the title
print -Pn "\e]0;"
# show hostname if connected through ssh
[[ "$SSH_CONNECTION" != '' ]] && print -Pn "(%m) "
# shows the full path in the title
print -Pn '\e]0;%~\a'
print -Pn "%~\a"
# get vcs info
vcs_info