config

Personal configuration.
git clone git://code.dwrz.net/config
Log | Files | Refs

commit 0323dffd9e680cfee8bcb88bcae6259cc203053a
parent 16583ac714f43067997007f449fed619c4278af7
Author: dwrz <dwrz@dwrz.net>
Date:   Sun,  4 Feb 2024 12:43:15 +0000

Add vterm support to bashrc

Diffstat:
Mbash/bashrc | 19+++++++++++++++++++
1 file changed, 19 insertions(+), 0 deletions(-)

diff --git a/bash/bashrc b/bash/bashrc @@ -98,6 +98,25 @@ ts() { tmux new-session -A -s "$session" } +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 + # Options complete -cf doas