The getting started guide on GitHub looks super thorough.

https://tmuxcheatsheet.com

https://www.outcoldman.com/cheatsheets/tmux

Server vs session vs window vs pane

Remote Pair Programming With SSH & tmux

Most Neovim users seem to run Neovim inside tmux in lieu of using an integrated editor (Reddit)

Before running any command, press ctrl + b, then release and press the next key. The ctrl + b key combo is known as <leader>.

Split window horizontally: <leader> %

Split window vertically: <leader> "

List sessions: <leader> :ls.

Create new session in different directory: <leader> :new -c ~/your/desired/path

Switch sessions: <leader> s (thanks Stack Overflow).

Switch windows: <leader> w (useful!)

Create a new window in the session: <leader> c

You can jump between windows using <leader> [number], but often each session only has one window attached. These are zero indexed.

To kill a session interactively, open the session manager with <leader> s, then tag a session with t, type X to close, then confirm with y + enter.

Reordering windows https://superuser.com/questions/343572/how-do-i-reorder-tmux-windows

Scrolling

https://superuser.com/a/1484975
On OSX Mojave and newer, after entering copy mode with ctrl + b [, you can do:

  • up arrow for line up
  • down arrow for line down
  • fn + up arrow for page up
  • fn + down arrow for page down
  • q to quit copy mode

Copying and pasting the tmux way

https://superuser.com/a/293678

You use space bar for the beginning of the selection and enter for the end.

copy:

  • Ctrlb[
  • Space
  • Enter

paste:

  • Ctrlb]

exit copy mode:

  • q

Set active session’s directory

<leader> :attach-session -t . -c new_working_dir (thanks chriserin)

or

<leader> :a -c new_working_dir (short version)

Enable mouse in current session

<leader> :set -g mouse (thanks RedHat)

or

<leader> :set mouse on

Copying to MacOS clipboard with mouse

https://stackoverflow.com/questions/12287432/how-to-copy-to-system-clipboard-from-tmux-output-after-mouse-selection

On macOS Terminal Tmux, copying from a specific pane:

  1. Hold option (cursor changes to crosshair) [See * below]
  2. Click and drag to select text
  3. Copy/paste as normal, with CMD-C/V

*You may need to toggle “Allow mouse reporting” with CMD-R (see Terminal, View-…). I find that I often toggle this to either scroll with mouse inside tmux panes, or to copy-paste.

Settings

These are settings for ~/.tmux.conf:

set-option -g mouse on
set-window-option -g mode-keys vi

set -sg escape-time 0