In an attempt to live inside the terminal, I have finally started learning how to use tmux
.
I am primarily using it in conjunction with Vim
(the other option of living inside the terminal would be living inside emacs
... maybe some day?), and I use the vim-tmux-navigator, which makes moving between tmux
and Vim
a breeze.
It simplifies the binding left/right/down/up to <C-h>
, <C-l>
, <C-j>
, <C-k>
.
Thoughtbot gives an amazing tutorial of how to install vim-tmux-navigator
, but to defend against link rot, here are the reproduced steps:
-
Install
vim-tmux-navigator
, i.e. viaVundle
. -
Add the following to
~/.tmux.conf
:# smart pane switching with awareness of vim splits bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L" bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D" bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U" bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R" bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys 'C-\\') || tmux select-pane -l"
Otherwise, here is a cheatsheet of some commands I use, all prefixed by <C-b>
(Control + b):
d
: Detach session$
: Change session Namea
: Attach to last sessiona -t [NAME]
: Attach to session [NAME]c
: New window,
: Rename windown
: Next windowp
: Previous windoww
: List windows%
: Vertical split"
: Horizontal splitz
: Maximize pane