06.11.14

Properly disable terminal capabilities for alternate screen in tmux

A lot of places recommend to use the following tmux config to disable the (outer) terminal emulator's alternate screen:

set -g terminal-overrides 'xterm*:smcup@:rmcup@'

But this will override the default value of the `terminal-overrides` setting, and therefore the following should be used instead:

set -ga terminal-overrides ',xterm*:smcup@:rmcup@'

Without using the "append" (-a) option with "set", the defaults would be overwritten, which are currently:

*256col*:colors=256,xterm*:XT:Ms=\E]52;%p1%s;%p2%s\007:Cs=\E]12;%p1%s\007:Cr=\E]112\007:Ss=\E[%p1%d q:Se=\E[2 q,screen*:XT

The tmux FAQ has been updated.

Another method to remove the "smcup" and "rmcup" capabilities globally is the following (via ~/.zshrc, ~/.bashrc etc):

Code:

# Remove smcup/rmcup term capabilities globally.
# See also ~/.dotfiles/tmux.common.conf (terminal-overrides).
# Source: https://blogs.oracle.com/samf/entry/smcup_rmcup_hate
# Fixed: remove escaping backslash from sed regexps.
TERMINFO="/tmp/$(id -un)-terminfo-$TERM-$(uname -s)-fixed"
export TERMINFO
if [[ ! -d $TERMINFO ]]; then
    mkdir -p $TERMINFO
    infocmp | sed -e 's/smcup.*,' -e 's/rmcup.*,' -e '/^[ \t]*$/d' \
      > $TERMINFO/fixed
    sed -e '1d' -e '3,$d' < $TERMINFO/fixed | grep -w $TERM >/dev/null 2>&1
    if [[ $? -ne 0 ]]; then
        mv $TERMINFO/fixed $TERMINFO/broken
        sed -e "2s/^/$TERM|/" < $TERMINFO/broken > $TERMINFO/fixed
    fi
    tic $TERMINFO/fixed
fi
By Daniel in computer, Snippets, Planet Ubuntu2014-11-06 English (EU) Email

No feedback yet

Leave a comment


Your email address will not be revealed on this site.
(Line breaks become <br />)
(Name, email & website)
(Allow users to contact you through a message form (your email will not be revealed.)
This is a captcha-picture. It is used to prevent mass-access by robots.
Please enter the characters from the image above. (case insensitive)
You can just use your OpenID to provide your name, e-mail and url.
Seitenleiste