Learning tmux
Jan 29, 22Ok, while I am struggling for inspiration on which app to build on casually.io, I am procrastinating by picking back up tmux to try and increase my productivity on the command line
Here are some tips for future me:
- Create a
.tmux.conf
file in your home path - dump the below code into it
# use ctrl + j as the prefix
unbind C-b
set-option -g prefix C-j
bind-key C-j send-prefix
# add a little bit of mouse flava
set -g mouse on
# use the juicy vi mode
setw -g mode-keys vi
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel
# make splitting the screen easier - noice
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %
# make rotaty super easy
bind C-j rotate-window
# reload this config easier (comment out when not using?)
bind r source-file ~/.tmux.conf
- open a tmux session using
tmux
- run
tmux source ~/.tmux.conf
Tips
- use
man tmux
to see the full instructions for using tmux - use
C-j ?
to see a full list of key binds - super useful! - as we have set
C-j
to be rotaty, you can just hold down control and pressj
twice to cycle to the next pane - noice - to enter copy mode on any screen, press
C-j [
- we have vim mode enabled for copy mode, so navigate with hkjl as usual - to start selecting text, press
spacebar
, and to copy to the clipboard and exit copy-mode, pressenter
- to paste from the buffer, press
C-j ]
- awesome!