Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nested tmux escape sequence for bash prompt tracking #552

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,12 @@ For `bash` or `zsh`, put this in your `.zshrc` or `.bashrc`
```bash
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"
# Tell both simple and nested tmux to pass the escape sequences through
# There is no easy way to detect nested tmux (expecially over ssh), so
# it is more user friendly to enable the nested version by default
printf '\ePtmux;\e\ePtmux;\e\e\e\e]%s\a\e\e\\\e\' "$1"
# Uncomment the fllowing to enable the simple version:
# 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"
Expand Down
8 changes: 6 additions & 2 deletions etc/emacs-vterm-bash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@

function 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"
# Tell both simple and nested tmux to pass the escape sequences through
# There is no easy way to detect nested tmux (expecially over ssh), so
# it is more user friendly to enable the nested version by default
printf '\ePtmux;\e\ePtmux;\e\e\e\e]%s\a\e\e\\\e\' "$1"
# Uncomment the fllowing to enable the simple version:
# 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"
Expand Down