tmux

Starting a Session

  • From scratch: tmux new -ssessionname
  • From tmuxinator: tmuxinator start [projectname]

Managing tmuxinator Projects

  • Creating: tmuxinator new [projectname]
  • Editing: tmuxinator edit [projectname]

Commands Within tmux

  • C-b ? - list key bindings
  • C-b : - command prompt
    • kill-session - quit tmux entirely
  • Windows
    • C-b c - create new window
    • C-b [0-9] - switch to window by number
    • C-b & - prompt to kill window
  • Panes
    • C-b % - split horizontally
    • C-b " - split vertically
    • C-b Up - switch active pane to pane above
    • C-b Down - switch active pane to pane below
    • C-b x - kill active pane
    • C-b page-up/page-down - scroll within a pane. Press q to exit scrolling mode
    • C-b z - toggle zooming active pane to fill whole window

Config

  • Reloading: tmux source ~/.tmux.conf within a tmux terminal

iTerm/tmux/tmuxinator Integration

In tmuxinator config file (ref):

attach: false
on_project_exit: tmux -CC attach

In iTerm2 settings:

  • General
    • tmux
      • When attaching, restore windows as: Tabs in the attaching window

https://iterm2.com/documentation-tmux-integration.html

  • esc to exit tmux keeps the session (and processes within them) running in the background. Rerunning tmuxinator [name] reconnects to it
  • Check if sessions are running: tmux ls
  • To fully quit out of a session in iTerm2 integration mode: tmux kill-session [name]