]> code.delx.au - dotfiles/commitdiff
bash: pre-exec xterm titlebar
authorJames Bunton <jamesbunton@delx.net.au>
Tue, 26 Feb 2019 00:20:52 +0000 (11:20 +1100)
committerJames Bunton <jamesbunton@delx.net.au>
Tue, 26 Feb 2019 00:38:11 +0000 (11:38 +1100)
.bashrc

diff --git a/.bashrc b/.bashrc
index dabceac606adb1d728c28fe03d2d6bd48c7008ce..8a8408861533eec7bc4aecec7fd241679aa5ca91 100644 (file)
--- a/.bashrc
+++ b/.bashrc
@@ -70,9 +70,6 @@ export HISTTIMEFORMAT='%F %T '
 # Disable CTRL-s / CTRL-q
 stty -ixon
 
-# hostname:workingdir
-PROMPT_COMMAND='echo -ne "\\033]0;$(hostname|cut -d. -f1):${PWD/$HOME/\~}\\007"'
-
 # Use dark background colors in apps like vim
 export COLORFGBG='15;0'
 
@@ -241,8 +238,6 @@ fi
 
 # man with coloured headings and a terminal title
 function man {
-    echo -ne "\\033]0;man $*\\007"
-
     env \
         LESS_TERMCAP_md=$'\E[01;38;5;74m' \
         LESS_TERMCAP_me=$'\E[0m' \
@@ -278,8 +273,26 @@ function ssh_unsafe {
     ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "$@"
 }
 
+
+#########################
+# Optional local config #
+#########################
+
+[ -r ~/.bashrc_local ] && source ~/.bashrc_local
+
+
+##################
+# xterm titlebar #
+##################
+
+# When at a prompt display `hostname:workingdir`
+PROMPT_COMMAND='echo -ne "\\033]0;$(hostname|cut -d. -f1):${PWD/$HOME/\~}\\007"'
+
+# Display the command about to be executed
+# This must go at the end of bashrc to avoid running the trap on commands in the bashrc
+trap 'echo -ne "\\033]0;$BASH_COMMAND\007"' DEBUG
+
+
 ###########
 # The end #
 ###########
-
-[ -r ~/.bashrc_local ] && source ~/.bashrc_local