botbotbot 's blog

Tmux

list binding key

PREFIX ? - list keys

Leaving and Coming Back Again

PREFIX d - leave

# Come Back
$ tmux a

windows

PREFIX c - create window
PREFIX , - rename window
PREFIX n - next window
PREFIX p - previous window
PREFIX {num} - go to {num} window
PREFIX & - exit window

panes

PREFIX % - split pane in vertically
PREFIX “ - split pane in horizontally
PREFIX o - switch between panes
PREFIX {arrow} - move around the panes
PREFIX q - show pane number and its size
PREFIX x - kill pane
PREFIX z - toggle pane to be fullscreen
PREFIX {, } - swap panes
PREFIX ! - turn pane to window

Copy & Paste to System Clipboard

Copying between tmux buffers and the system clipboard
Share buffer with system clipboard
tmux Copy & Paste on OS X: A Better Future
Copy Mode - Linux TMUX Video Tutorial

# .tmux.conf
setw -g mode-keys vi
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-selection
bind -t vi-copy y copy-pipe 'xclip -in -selection clipboard'
  • Copy to Buffer

    1. PREFIX [ - scroll buffer use arrow key to move around and enter to quit
    2. v - select word
    3. y - copy (yank) word
  • Paste from buffer PREFIX ]

Create Custom Layout

#Window: python dev (Prefix - Meta(Alt) + d)
# -v = split horizontal
bind-key M-d split-window -v -p 30 -t 0 \; \
         send-keys './watchdog_python.py' 'Enter' \; \
         select-pane -t 0

tmuxinator

$ gem install tmuxinator
export EDITOR=vim

wemux

# OSX via Homebrew
$ brew install wemux

Unable to use ‘open’ command in OSX tmux

brew update
brew install reattach-to-user-namespace
echo "set -g default-command \"reattach-to-user-namespace -l ${SHELL}\"" >> ~/.tmux.conf

How to convert 2 horizontal panes to vertical panes in tmux?

Prefix + space

Reference:

  1. A tmux Tutorial and Primer
  2. love hate tmux
  3. Thoughtbot tmux
  4. screen and tmux
  5. screen to tmux: A Humble Quick-start Guide
  6. Tmux: A Simple Start
  7. Humans Present: tmux
  8. tmux tutorial
  9. Practical Tmux
  10. tmuxinator: Save tmux pane and window layouts
  11. Tmuxify your Tmux. Powerful session, window & pane management for Tmux.
  12. Beginner’s Guide to Tmux: Recommended Configuration, Plugins and Navigation Demo
  13. Tmux Plugin Manager - tmux-plugins