diff --git a/bash/bashrc b/bash/bashrc index 6212c15d7..7d0e23e12 100644 --- a/bash/bashrc +++ b/bash/bashrc @@ -52,10 +52,18 @@ if ! shopt -oq posix; then fi fi +if [[ -z $TERM_TITLE ]]; then + TERM_TITLE="$TERM"; +fi + # Set window title to last command -PROMPT_COMMAND='echo -e -n "\033]2;$_\007"' -# Reconfigure prompt after each return -PROMPT_COMMAND="$PROMPT_COMMAND; source ${HOME}/.dotfiles/bash/prompt.sh" +function last_command { + local h="$(history 1)"; + echo "${h##*([[:space:])+([[:digit:]])+([[:space:]])}" +} +PS0='\[\e]0;$(last_command) - $TERM_TITLE\a\]' +# Update prompt +PROMPT_COMMAND="source ${HOME}/.dotfiles/bash/prompt.sh" # Bell when prompt is returned to mark as urgent PROMPT_COMMAND="$PROMPT_COMMAND;printf \"\a\"; history -a"