aboutsummaryrefslogtreecommitdiff
path: root/.bashrc
diff options
context:
space:
mode:
Diffstat (limited to '.bashrc')
-rw-r--r--.bashrc19
1 files changed, 18 insertions, 1 deletions
diff --git a/.bashrc b/.bashrc
index e06cbd7..b11573e 100644
--- a/.bashrc
+++ b/.bashrc
@@ -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
nihil fit ex nihilo