diff options
author | Raul Benencia <id@rbenencia.name> | 2023-01-21 11:08:23 -0800 |
---|---|---|
committer | Raul Benencia <id@rbenencia.name> | 2023-01-21 11:08:23 -0800 |
commit | 7656741090f8bdaff176cf7127944cc58b24ce68 (patch) | |
tree | 56904a973ed9e8345e883356d471ebf344851fa2 | |
parent | 7706c8c5d32eb6d220259048b6b4e87daee87961 (diff) |
bash: add support for emcas directory tracking
-rw-r--r-- | .bashrc | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -61,6 +61,22 @@ fi umask 022 +vterm_printf() { + if [ -n "$TMUX" ] && ([ "${TERM%%-*}" = "tmux" ] || [ "${TERM%%-*}" = "screen" ]); then + # Tell tmux to pass the escape sequences through + printf "\ePtmux;\e\e]%s\007\e\\" "$1" + elif [ "${TERM%%-*}" = "screen" ]; then + # GNU screen (screen, screen-256color, screen-256color-bce) + printf "\eP\e]%s\007\e\\" "$1" + else + printf "\e]%s\e\\" "$1" + fi +} + +vterm_prompt_end(){ + vterm_printf "51;A$(whoami)@$(hostname):$(pwd)" +} + update_title () { printf "\e]0;$USER@$HOSTNAME: %s\a" "$1" } @@ -96,11 +112,12 @@ PS1='\u@\h:\w$vcsinfo> ' case "$TERM" in xterm*|rxvt*|screen) - PS1="\[\e]0;\u@\h:\w\a\]$PS1" + PS1="\[\e]0;\u@\h:\w\a\]$PS1"'\[$(vterm_prompt_end)\]' trap show_command DEBUG PROMPT_COMMAND=prompt_command ;; *) + PS1=$PS1'\[$(vterm_prompt_end)\]' PROMPT_COMMAND=prompt_command_notitle ;; esac |