Tmux configuration

From wikinotes
Revision as of 16:53, 18 September 2021 by Will (talk | contribs) (→‎keybindings)

This page documents some commands I use most frequently.

Documentation

keybindings https://man.archlinux.org/man/community/tmux/tmux.1.en#KEY_BINDINGS
mouse https://man.archlinux.org/man/community/tmux/tmux.1.en#MOUSE_SUPPORT

Locations

~/.tmux.conf config

Commands

notifications

set -g display-time 5000                     # message display duration
display-message -c /dev/pts/0 'hello world'  # show a message

terminal

set -g default-terminal "screen-256color"  # desired $TERM value
set -g visual-bell off
set -g visual-activity off
set -g bell-action current

mouse

set -g mouse on

statusbar

set -g pane-base-index 1
set -g status-position top
setw -g clock-mode-style 2

source-file

source-file ${FILE}  # import file

keybindings

See KEYBINDINGS section in man page.

Keys are bound within tables. by default, they are bound to the prefix table (active following tmux-prefix keyseq).
Keys executed without a prefix are defined in the root table.
bind and bind-key can be used interchangeably.

tmux bind-key \
  [-n] `# bind w/o prefix (root table)` \
  [-r] `# repeatable` \
  [-N ${NOTE}] \
  [-T ${KEY_TABLE}] \
  ${KEY} \
  ${TMUX_COMMAND} ${ARGUMENTS[@]}
bind-key     F1   set-option status off  # bind key-sequence
bind-key -n  M-0  select-window -t 10    # bind key-sequence to root table (no prefix reqd)

unbind C-b                               # unbind key-sequence

tmux prefix

set -g prefix 'M-a'                      # set (additional) alternative tmux-prefix

enable vi mode

set -g mode-keys vi
set -g status-keys vi