Want to see the full-length video right now for free?
Sign In with GitHub for Free AccessTmux has 3 interfaces for running commands and making configurations:
tmux
command available in your shell. All
commands can be run directly against this, but note that any configurations
set via the tmux
command will be cleared when the server is shut down.<prefix>:
and will
temporarily take over the tmux status bar. Note, there is no need to type
tmux
before a command when in the command prompt. Also, just like with the
executable, any configurations made will be cleared when the server is shut
down..tmux.conf
file - The final (and primary) method for configuring
tmux, this file lives in your home directory and is read by tmux when the
server first starts up (when you start your first session). The configuration
syntax is identical to what you run against the executable or in the command
prompt, so both can be used to test out commands and configurations prior to
adding them to your .tmux.conf
. This file will be read every time the
server starts up but will not be read when opening new windows, panes, or
sessions after the server starts. See below for how to reload the config file
manually.Add the following to your .tmux.conf
to allow for reloading your
.tmux.conf
. This allows for rapid iteration on your configuration and
making sure any updates you make to your tmux configuration will persist for
future sessions.
bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded"
By default, all tmux key-bindings will require you to type the prefix key sequence first, then the desired key to activate the binding. There are two flags that can be used to circumvent the prefix key:
-n
- This flag allows the key-binding to run without need for the prefix
key. Note, since tmux wraps all terminal interaction, setting any
key-binding with the -n
flag will essentially prevent you from sending that
sequence through to underlying processes such as Vim since tmux will catch
the key sequence and act on it.-r
- This flag allows key-bindings to be repeated without requiring the
prefix key.The status-right
option configures the text displayed on the right side of
the tmux status bar and configured with a combination of:
#S
for the session name
will be replaced with the corresponding value. See the FORMATS
section of
the tmux man page for more options.#(...)
, and it will be replaced with its output.The battery
command used in the tmux prompt comes from Nicolas Goles's
battery script, which can be installed via homebrew.
The .tmux.conf
as of the end of step 2:
unbind C-b
set -g prefix C-s
bind-key -r C-s send-prefix
bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded"
bind-key -n C-h select-pane -L
bind-key -n C-j select-pane -D
bind-key -n C-k select-pane -U
bind-key -n C-l select-pane -R
set-option -g default-terminal "screen-256color"
set-option -g status-keys "emacs"
set-option -g status-bg '#666666'
set-option -g status-fg '#aaaaaa'
set-option -g status-left-length 50
set-option -g status-right " #(battery -t) #(date '+%a, %b %d - %I:%M') "