Using tmux - scrolling via ssh

13,514

Assuming your terminal program is not hijacking the mouse wheel inputs, you should be able to add this to your $HOME/.tmux.conf (for tmux >= 2.1)

set-option -g mouse on

Depending upon your terminal program, this option may help as well, allowing tmux to tell your terminal that it wants more control over the contents of the terminal window.

setw -g alternate-screen on

Regarding your comment:

Sometimes I can scroll off the tmux window and see the tmux attach command. Is that normal?

If you haven't set that option in your tmux config, then yes, that is expected. You are likely scrolling back in the buffer history of your terminal program rather than tmux's buffer.

Finally, more information can be found in other questions that are essentially the same: here, generically and here (for MacOS and iTerm)

Share:
13,514

Related videos on Youtube

Adam Hunyadi
Author by

Adam Hunyadi

Updated on September 18, 2022

Comments

  • Adam Hunyadi
    Adam Hunyadi over 1 year

    Instead of ssh-ing from many terminal windows to a remote server, I deceded to start using tmux via one single ssh connection. There are things I cant seem to get working though.

    The most important is, how do I make the terminal mouse-scrollable? bash setw -g mode-mouse on seems to do nothing. Can I somehow configure my terminal to send the actions of scrolling via ssh too?

    If it is impossible, is there a workaround to bind page-up and page-down to scroll up and down?

    I am using tmux-2.5rc via ssh -YX and other applications allow mouse scrolling.

    • Adam Hunyadi
      Adam Hunyadi almost 7 years
      Sometimes I can scroll off the tmux window and see the tmux attach command. Is that normal? :D
  • Adam Hunyadi
    Adam Hunyadi almost 7 years
    Ah, it worked. I tried doing setw instead of set-option before.