Skip to content

Instantly share code, notes, and snippets.

@j1g54w1337
Last active February 6, 2022 17:15
Show Gist options
  • Select an option

  • Save j1g54w1337/ed74ebbd8fe770458f1d7d782f77b67f to your computer and use it in GitHub Desktop.

Select an option

Save j1g54w1337/ed74ebbd8fe770458f1d7d782f77b67f to your computer and use it in GitHub Desktop.
tmux tips and trick

tmux tips and tricks

Shortlist

Key Description
CTRL A Prefix
M Edit .tmux.conf
r Reload .tmux.conf
v Edit .vimrc.local
h Edit .zshrc
u Reload .zshrc
F Toggle between smallest and largest sizes if a windows is visible in multiple places
m Monitor activity
y Toggle synchronize panes

Set prefix key to CTRL A

set -g prefix C-a
unbind C-b
bind C-a send-prefix

Get tmux help

Press CTRL + a, ? for the full list of set keyboard shortcuts

Quickly edit and reload tmux configuration

bind-key M split-window -h "vim ~/.tmux.conf"                                 
bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded"

Quickly edit vim configuration

bind-key v split-window -h "vim ~/.vimrc.local"

Quickly edit and reload zsh configuration

bind-key h split-window -h "vim ~/.zshrc"                             
bind-key u source-file ~/.zshrc \; display-message "~/.zshrc reloaded"

A key to toggle between smallest and largest sizes if a window is visible in multiple places

bind F set -w window-size

Keys to toggle monitoring activity in a window and the synchronize-panes option

bind m set monitor-activity                                                            
bind y set synchronize-panes\; display 'synchronize-panes #{?synchronize-panes,on,off}'

Copy and Paste between panes

  1. Press CTRL + a, [ to enter copy mode.
  2. Move to start/end of text to highlight.
  3. Press CTRL + Space.
  4. Move to opposite end of the text you want to copy.
  5. ALT + w Copies selected text into the tmux clipboard. In MacOS, use ESC + w. Try Enter if none of the above works.
  6. Move cursor to opposite tmux pane, or completely different tmux window. Put the cursor where you want to paste the text you just copied.
  7. Press CTRL +b, ] to paste copied text from tmux clipboard.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment