Skip to main content

Tmux

Introduction

General

Sessions

  • Attach to last session: $ tmux a
  • Attach to session β€œname”: $ tmux a -t name
  • Create session: $ tmux or Prefix + :new
  • Create session ”name”: $ tmux new -s name or Prefix + :new -s name
  • List sessions: $ tmux ls or Prefix + s
  • Move to previous session: Prefix + (
  • Move to next session: Prefix + )
  • Rename active session: Prefix + $
  • Detach from active session: Prefix + d
  • Hidden Tmux POWER: The Missing 50% β€’ Covers the SessionX session manager plugin β€’ DevOps Toolbox πŸ“Ί

Windows

  • Create window: Prefix + c
  • List session windows: Prefix + w
  • Rename window: Prefix + ,
    • I changed this to Prefix + r

Panes

  • Create vertical pane: Prefix + %
  • Create horizontal pane: Prefix + "
  • Move to next pane: Prefix + o
  • Alternate panes: Prefix + ;
  • Close pane: Prefix + x

Configuring

# remap prefix from C-b to C-a
unbind C-b
set -g prefix C-a
bind C-a send-prefix

Examples

Pop-ups

Plugins

Zellij

Inbox

  • Change tmux default to zsh - Stack Overflow β€’ When tmux opens, I would like it to use zsh instead of bash by default. How would I accomplish this? πŸ‘¨β€πŸ’»
  • Writing Your tmux Config: a Detailed Guide β€’ The Valuable Dev πŸ‘¨β€πŸ’»
  • Setting Options in tmux β€’ Sean Hickey πŸ‘¨β€πŸ’»
  • A UX Expert Fixes My Tmux - nice recommendation to simplify boilerplate and move status bar to the top of the screen to avoid clutter at the bottom when vim’s status bar is active - DevOps Toolbox
  • vim + tmux with Nick Nisi - Josh Medeski & Nick Nisi
    • comparing their tmux + vim workflows
    • tmux ideas:
      • searching sessions with fzf
      • auto-creating sessions named after folder
      • auto-replacing window names with icons
      • if using git worktrees
        • clone bare repo so the main project folder just contains subfolders named after local branches (no project files at root level) to avoid finding duplicate files when searching in vim
        • launch separate vim session per worktree
      • status bar at top
    • vim ideas:
      • automatically open telescope find files on startup
      • telescope input box at top
      • 31:00: super minimal status bar (only lsp/git diff counts; no mode, filetype, line count etc)
  • intro: Tmux has forever changed the way I write code. - Great video walking through how to quickly install and configure tmux to be nice to look at and work with - Dreams of Code
  • pvolok/mprocs: Run multiple commands in parallel - tmux alternative for defining collections of processes to run in parallel
  • kitty: trying out using kitty as a replacement for tmux (since I primarily use tmux for session/window management); so far, so good: the startup session feature is a nice replacement for tmux resurrect (since I generally want the same starting point each day since I tend to focus on a consistent shortlist of projects on each device)