From 84b379495231ec2048724a215a308e1f903df751 Mon Sep 17 00:00:00 2001 From: MountainMan <43313373+MountainMan1312@users.noreply.github.com> Date: Mon, 29 May 2023 02:04:13 -0400 Subject: Fix `.bashrc` for Emacs Vterm (again) --- home/.bashrc | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/home/.bashrc b/home/.bashrc index 62d5c8e..620ea76 100644 --- a/home/.bashrc +++ b/home/.bashrc @@ -91,12 +91,29 @@ alias ls="exa -1aFghlmU --git --color=always --sort=name --time-style=iso --grou ######################################################################## -# Fix for Emacs vterm -##################### +# Fixes for Emacs vterm +####################### +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 +} + if [[ "$INSIDE_EMACS" = 'vterm' ]]; then function clear() { vterm_printf "51;Evterm-clear-scrollback"; tput clear; } fi + +vterm_prompt_end(){ + vterm_printf "51;A$(whoami)@$(hostname):$(pwd)" +} +PS1=$PS1'\[$(vterm_prompt_end)\]' ######################################################################## -- cgit v1.2.3