From 2a0700d700486e41c1674b6abdd87de2764fa3ad Mon Sep 17 00:00:00 2001 From: Ira Abramov Date: Sun, 6 Nov 2016 13:44:49 +0200 Subject: [PATCH 1/2] support short hostnames in xterm title --- plugins/available/xterm.plugin.bash | 4 ++-- template/bash_profile.template.bash | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/available/xterm.plugin.bash b/plugins/available/xterm.plugin.bash index 662dfa83..8bda7f58 100644 --- a/plugins/available/xterm.plugin.bash +++ b/plugins/available/xterm.plugin.bash @@ -8,11 +8,11 @@ set_xterm_title () { precmd () { - set_xterm_title "${USER}@${HOSTNAME} `dirs -0` $PROMPTCHAR" + set_xterm_title "${USER}@${SHORT_HOSTNAME:-${HOSTNAME}} `dirs -0` $PROMPTCHAR" } preexec () { - set_xterm_title "$1 {`dirs -0`} (${USER}@${HOSTNAME})" + set_xterm_title "$1 {`dirs -0`} (${USER}@${SHORT_HOSTNAME:-${HOSTNAME}})" } case "$TERM" in diff --git a/template/bash_profile.template.bash b/template/bash_profile.template.bash index ea9a9860..a3fe9cfb 100755 --- a/template/bash_profile.template.bash +++ b/template/bash_profile.template.bash @@ -26,6 +26,11 @@ export TODO="t" # Set this to false to turn off version control status checking within the prompt for all themes export SCM_CHECK=true +# Set Xterm/screen/Tmux title with only a short hostname. +# Comment this (or unset SHORT_HOSTNAME) to fall back on $HOSTNAME. + +export SHORT_HOSTNAME=$(hostname -s) + # Set vcprompt executable path for scm advance info in prompt (demula theme) # https://github.com/djl/vcprompt #export VCPROMPT_EXECUTABLE=~/.vcprompt/bin/vcprompt From 52efa850dfd58ef7c00f1ca568f677286d8f7510 Mon Sep 17 00:00:00 2001 From: Ira Abramov Date: Mon, 7 Nov 2016 11:17:58 +0200 Subject: [PATCH 2/2] was asked to avoid changing default behavior. --- template/bash_profile.template.bash | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/template/bash_profile.template.bash b/template/bash_profile.template.bash index a3fe9cfb..e9032051 100755 --- a/template/bash_profile.template.bash +++ b/template/bash_profile.template.bash @@ -27,9 +27,9 @@ export TODO="t" export SCM_CHECK=true # Set Xterm/screen/Tmux title with only a short hostname. -# Comment this (or unset SHORT_HOSTNAME) to fall back on $HOSTNAME. - -export SHORT_HOSTNAME=$(hostname -s) +# Unomment this (or set SHORT_HOSTNAME to something else), +# Will otherwise fall back on $HOSTNAME. +#export SHORT_HOSTNAME=$(hostname -s) # Set vcprompt executable path for scm advance info in prompt (demula theme) # https://github.com/djl/vcprompt