Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I know how to scroll in tmux using the keyboard, but I noticed that it looks like there's a way to use the terminal scrollbar with GNU Screen. Can this be done with tmux?

share|improve this question
5  
You can't really use the terminal scrollbar with GNU Screen. The scrollbar won't actually access Screen's scrollback buffer, but the terminal's, which means that scrolled-off lines from different Screen sessions get mixed up. –  ak2 Jul 14 '11 at 11:18
    
@ak2 Sadness... but thanks for the info! –  Jeff Jul 14 '11 at 22:03
    
iTerm2 has some future plans to [integrate with tmux ](code.google.com/p/iterm2/wiki/TmuxIntegration). Such integration seems likely to include using a native scroll bar to view the tmux history buffer. –  Chris Johnsen Jul 25 '11 at 5:16

1 Answer 1

up vote 16 down vote accepted

This is possible in both Screen and in tmux and the workaround is similar: to fool the multiplexers into thinking that the terminal has no "alternate screen" mode (such as that used by pico, mutt, etc). This is accomplished by setting termcap commands for the session. For GNU screen, put this in your .screenrc:

termcapinfo xterm*|xs|rxvt|terminal ti@:te@

and for tmux, add this to your .tmux.conf:

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

The 'xterm*' part of the command should be set to whatever your terminal-emulator is declared as. Some form of xterm is a good guess, but you can check your on most sane *nix systems with:

echo $TERM

and this can usually be set in the preferences of your terminal program (ie: For Apple's Terminal.app, it's in Settings->Advanced->Emulation->"Declare terminal as"

The end result is that the overflow ends up in the terminal's scrollback buffer instead of disappearing. Of course, since this is one static buffer, things will get messy as you switch between screen or tmux windows, but this is handy for quickly flicking up to see the output of an ls command or the such.

share|improve this answer
1  
also, just saw superuser.com/questions/253414/… , which works as described as another alternative. –  Doug J Jul 25 '11 at 2:55
    
Working like a charm, thanks! –  Jeff Jul 25 '11 at 19:05
    
This doesn't work for me on OS X... –  Nick Apr 17 '12 at 13:57
1  
Solution: gist.github.com/1297707 –  Nick Apr 17 '12 at 15:24
1  
@Nick - Note that you're solving a different problem : adding mouse support to tmux. Might be a better solution for you, but it's different from using the native scrollback buffer. As long as your terminal emulator is properly defined the above will work on an y*nix, including OSX –  Doug J Apr 17 '12 at 17:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.