This is an updated blog post to reflect changes over the last five years (especially GitHub issue #1688) as I am still tmux terminal multiplexer on daily basis.
Brief description
Set default terminal type.
set -g default-terminal "screen-256color"
Disable mouse support.
set -g mouse off
Set default shell.
set -g default-shell /bin/zsh
Unbind the default C-b
prefix.
unbind-key C-b
Define `
(backtick) as new prefix.
set -g prefix `
Send `
backtick to the application after typing it twice.
bind-key ` send-prefix
Use prefix r
to read and process configuration.
# use prefix r to reload configuration bind-key r source-file ~/.tmux.conf \; display "Configuration reloaded"
Start counting windows from 1.
set -g base-index 1
Always renumber windows, so indexes remain sequential.
set-option -g renumber-windows on
Start counting panes from 1.
set-window-option -g pane-base-index 1
Define the left part of the status bar as an empty character for better readability.
set -g status-left " "
Define the right part of the status bar as session hostname time.
set -g status-right-length 100 set -g status-right '#[fg=#eee8d5]#S #[fg=#268bd2]#h #[fg=#839496]%d.%m.%y #[fg=#eee8d5]%H:%M '
Do not allow programs to rename windows.
set-option -g allow-rename off
Do not monitor for activity and silence by default.
set-window-option -g monitor-activity off set-window-option -g monitor-silence 0
Do not display messages about silence, bell, and activity.
set -g visual-activity off set -g visual-bell off set -g visual-silence off
Use blink
style for activity and bold
for bell.
set-window-option -g window-status-activity-style blink set-window-option -g window-status-bell-style bold
Define key bindings for easy activity/silence window monitoring.
bind-key M-a set-window-option monitor-activity on \; display "Monitoring window for activity" bind-key M-A set-window-option monitor-activity off \; display "NOT monitoring window for activity" bind-key M-s set-window-option monitor-silence 15 \; display "Monitoring window for silence" bind-key M-S set-window-option monitor-silence 0 \; display "NOT monitoring window for silence"
Switch panes using alt arrow
ommitting prefix.
bind -n M-Left select-pane -L bind -n M-Right select-pane -R bind -n M-Up select-pane -U bind -n M-Down select-pane -D
Set window background.
set-window-option -g window-style 'bg=#073642' set-window-option -g window-active-style 'bg=#073642'
Set message style.
set -g message-style fg="#dc322f"
Set status bar colors.
set -g status-style bg='#002b36',fg='#eee8d5'
Set panel border colors.
set -g pane-active-border-style fg="#268bd2",bg='#073642' set -g pane-border-style fg="#93a1a1",bg='#073642'
Use vi key bindings in copy mode.
set-window-option -g mode-keys vi
Configure clock.
set-window-option -g clock-mode-colour "#268bd2" set-window-option -g clock-mode-style 24
Define colors for the window list in the status bar.
set -g window-status-current-format "#[fg=#268bd2]#[bg=#002b36][#I] #W" set -g window-status-format "#[fg=#93a1a1]#[bg=#002b36][#I] #W"
Use prewif W
to toggle output save.
bind W pipe-pane -o "tee -a ~/#W.log" \; display "Toggled logging to ~/#W.log"
Use prefix S
, prefix alt-S
to capture the buffer.
bind-key S capture-pane -b temp-capture-buffer -S - \; save-buffer -b temp-capture-buffer ~/tmux.buffer \; delete-buffer -b capture-buffer bind-key M-S command-prompt -I "~/tmux.buffer" -p "Store current pane contents to file:" "capture-pane -b temp-capture-buffer -S -; save-buffer -b temp-capture-buffer %1; delete-buffer -b capture-buffer"
Use prefix C
to create a new window with provided name.
bind-key C command-prompt -p "Create window with name:" "new-window; rename-window '%%'"
Configuration file
My personal ~/.tmux.conf
configuration file.
# default terminal type set -g default-terminal "screen-256color" # disable mouse support set -g mouse off # set default shell set -g default-shell /bin/zsh # unbind the default prefix unbind-key C-b # set backtick as prefix set -g prefix ` # type backtick twice to send it to the application bind-key ` send-prefix # use prefix r to reload configuration bind-key r source-file ~/.tmux.conf \; display "Configuration reloaded" # start counting windows from 1 set -g base-index 1 # renumber windows, so indexes remain sequential set-option -g renumber-windows on # start counting panes from 1 set-window-option -g pane-base-index 1 # define left part of the status bar as one empty character for better readability set -g status-left " " # define right part of the status bar as session, hostname and time set -g status-right-length 100 set -g status-right '#[fg=#eee8d5]#S #[fg=#268bd2]#h #[fg=#839496]%d.%m.%y #[fg=#eee8d5]%H:%M ' # do not rename windows set-option -g allow-rename off # do not monitor for activity and silence by default set-window-option -g monitor-activity off set-window-option -g monitor-silence 0 # messages about silence, bell and activity set -g visual-activity off set -g visual-bell off set -g visual-silence off # define activity and bell style set-window-option -g window-status-activity-style blink set-window-option -g window-status-bell-style bold # define keys for easy activity/silence monitoring bind-key M-a set-window-option monitor-activity on \; display "Monitoring window for activity" bind-key M-A set-window-option monitor-activity off \; display "NOT monitoring window for activity" bind-key M-s set-window-option monitor-silence 15 \; display "Monitoring window for silence" bind-key M-S set-window-option monitor-silence 0 \; display "NOT monitoring window for silence" # switch panes using Alt-arrow without prefix bind -n M-Left select-pane -L bind -n M-Right select-pane -R bind -n M-Up select-pane -U bind -n M-Down select-pane -D # widow colors set-window-option -g window-style 'bg=#073642' set-window-option -g window-active-style 'bg=#073642' # message bar set -g message-style fg="#dc322f" # set status bar colors set -g status-style bg='#002b36',fg='#eee8d5' # set panel border colors set -g pane-active-border-style fg="#268bd2",bg='#073642' set -g pane-border-style fg="#93a1a1",bg='#073642' # use vi keys in copy and choice modes set-window-option -g mode-keys vi # clock set-window-option -g clock-mode-colour "#268bd2" set-window-option -g clock-mode-style 24 # set status bar window list colors set -g window-status-current-format "#[fg=#268bd2]#[bg=#002b36][#I] #W" set -g window-status-format "#[fg=#93a1a1]#[bg=#002b36][#I] #W" # save output (toggle) bind W pipe-pane -o "tee -a ~/#W.log" \; display "Toggled logging to ~/#W.log" # capture buffer bind-key S capture-pane -b temp-capture-buffer -S - \; save-buffer -b temp-capture-buffer ~/tmux.buffer \; delete-buffer -b capture-buffer bind-key M-S command-prompt -I "~/tmux.buffer" -p "Store current pane contents to file:" "capture-pane -b temp-capture-buffer -S -; save-buffer -b temp-capture-buffer %1; delete-buffer -b capture-buffer" # create new window and change name bind-key C command-prompt -p "Create window with name:" "new-window; rename-window '%%'"
This is splendid!