diff options
| author | Kyle Gerard Felker <felker@anl.gov> | 2021-01-07 23:58:02 -0600 |
|---|---|---|
| committer | jixiuf <jixiuf@qq.com> | 2021-02-07 11:55:15 +0800 |
| commit | 09cf48de5eb4db7520611bb55440141c15f18001 (patch) | |
| tree | 92962ea358ee3c675c3543d6f2f32e330478a863 | |
| parent | b6592f94d76098d19f242c0d09f660f6a6461b76 (diff) | |
Fix vterm_printf tmux escape sequence pass through
Such that it is not activated if Emacs and vterm are running within a
tmux session.
The passthrough still functions for running tmux within Emacs and vterm
| -rw-r--r-- | README.md | 4 | ||||
| -rw-r--r-- | etc/emacs-vterm-bash.sh | 2 | ||||
| -rw-r--r-- | etc/emacs-vterm-zsh.sh | 2 | ||||
| -rw-r--r-- | etc/emacs-vterm.fish | 2 |
4 files changed, 5 insertions, 5 deletions
@@ -242,7 +242,7 @@ readme. For `bash` or `zsh`, put this in your `.zshrc` or `.bashrc` ```bash vterm_printf(){ - if [ -n "$TMUX" ]; then + 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 @@ -258,7 +258,7 @@ This works also for `dash`. For `fish` put this in your `~/.config/fish/config.fish`: ```bash function vterm_printf; - if [ -n "$TMUX" ] + if begin; [ -n "$TMUX" ] ; and string match -q -r "screen|tmux" "$TERM"; end # tell tmux to pass the escape sequences through printf "\ePtmux;\e\e]%s\007\e\\" "$argv" else if string match -q -- "screen*" "$TERM" diff --git a/etc/emacs-vterm-bash.sh b/etc/emacs-vterm-bash.sh index 7d9fffb..c810ff6 100644 --- a/etc/emacs-vterm-bash.sh +++ b/etc/emacs-vterm-bash.sh @@ -4,7 +4,7 @@ # function that helps in this task, `vterm_printf`, is defined below. function vterm_printf(){ - if [ -n "$TMUX" ]; then + 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 diff --git a/etc/emacs-vterm-zsh.sh b/etc/emacs-vterm-zsh.sh index df9f36e..9006c5e 100644 --- a/etc/emacs-vterm-zsh.sh +++ b/etc/emacs-vterm-zsh.sh @@ -4,7 +4,7 @@ # function that helps in this task, `vterm_printf`, is defined below. function vterm_printf(){ - if [ -n "$TMUX" ]; then + 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 diff --git a/etc/emacs-vterm.fish b/etc/emacs-vterm.fish index dbff64c..4f3248a 100644 --- a/etc/emacs-vterm.fish +++ b/etc/emacs-vterm.fish @@ -4,7 +4,7 @@ # function that helps in this task, `vterm_printf`, is defined below. function vterm_printf; - if [ -n "$TMUX" ] + if begin; [ -n "$TMUX" ] ; and string match -q -r "screen|tmux" "$TERM"; end # tell tmux to pass the escape sequences through printf "\ePtmux;\e\e]%s\007\e\\" "$argv" else if string match -q -- "screen*" "$TERM" |
