From f3d36d7a42f349433b61208887a2d74fd4352021 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Brey?= Date: Fri, 21 Apr 2017 12:48:31 +0200 Subject: [PATCH] Support short username in xterm title plugin --- 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 8bda7f58..c16c5b8f 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}@${SHORT_HOSTNAME:-${HOSTNAME}} `dirs -0` $PROMPTCHAR" + set_xterm_title "${SHORT_USER:-${USER}}@${SHORT_HOSTNAME:-${HOSTNAME}} `dirs -0` $PROMPTCHAR" } preexec () { - set_xterm_title "$1 {`dirs -0`} (${USER}@${SHORT_HOSTNAME:-${HOSTNAME}})" + set_xterm_title "$1 {`dirs -0`} (${SHORT_USER:-${USER}}@${SHORT_HOSTNAME:-${HOSTNAME}})" } case "$TERM" in diff --git a/template/bash_profile.template.bash b/template/bash_profile.template.bash index 1822ada5..10eaaede 100755 --- a/template/bash_profile.template.bash +++ b/template/bash_profile.template.bash @@ -31,6 +31,11 @@ export SCM_CHECK=true # Will otherwise fall back on $HOSTNAME. #export SHORT_HOSTNAME=$(hostname -s) +# Set Xterm/screen/Tmux title with only a short username. +# Uncomment this (or set SHORT_USER to something else), +# Will otherwise fall back on $USER. +#export SHORT_USER=${USER:0:8} + # Set vcprompt executable path for scm advance info in prompt (demula theme) # https://github.com/djl/vcprompt #export VCPROMPT_EXECUTABLE=~/.vcprompt/bin/vcprompt