Moth

Scrolling with mosh and tmux

How to scroll through local history and sessions in mosh or tmux.

tmux mouse scrolling

When an application asks for mouse reporting, Moth sends scroll-wheel events to the program under the pointer. With tmux’s mouse mode enabled, tmux can use them to pick the right pane and enter copy mode:

tmux set -g mouse on

To keep this setting for future sessions, add it to your tmux configuration:

set -g mouse on

With mouse mode disabled, use tmux’s keyboard copy mode: its prefix key followed by [.

Trackpad movement, including momentum, accumulates into terminal rows rather than moving a whole row for each tiny event. Very large events are limited.

Local history and Shift-scroll

Hold Shift while scrolling to look through Moth’s own history instead of sending mouse events to the application. Outside programs that request mouse reporting, scrolling works normally.

Applications can also ask for wheel events to act like arrow keys using DEC mode 1007. Moth follows that request and the program’s cursor-key mode. Mouse reporting takes priority unless you hold Shift.

Plain mosh

Moth keeps alternate-screen scrollback by default, which lets you scroll through received lines in a plain mosh session using the wheel, trackpad or scrollbar. Find can search that history too. Its size follows your usual scrollback limit:

scrollback = 10000
alternateScreenScrollback = true

Local mosh history contains the screen updates received from the remote host. Output omitted by screen synchronisation is not recorded. This history is separate from the normal shell buffer and is cleared when the program leaves the alternate screen. It doesn’t reflow screen-coordinate applications when the window is resized. Set alternateScreenScrollback = false to turn it off.

New output won’t pull you away from the lines you’re reading. Scroll back to the bottom to follow it again. Mosh and tmux work as ordinary shell programs; Moth doesn’t have a separate remote-session integration layer.