Config

run-shell 'tmux setenv -g TMUX_VERSION $(tmux -V | sed -En "s/^tmux (next-)?([0-9]+(.[0-9]+)?).*/\2/p")'

# Use ctrl-w as prefix.
unbind C-b
bind C-w send-prefix

# Enable mouse.
set-option -g mouse on

# Set terminal to 256 colors.
set-option -g default-terminal "xterm-256colors"

# Support OSC 52.
set-option -ga terminal-overrides ",xterm-256colors:Tc:Ms=\\E]52;c;%p2%s\\7"
set-option -g set-clipboard on

set-option -g base-index 1
set-option -g renumber-windows on

# Enable xterm keys.
set-option -g xterm-keys on

# Set history buffer size to 10000.
set-option -g history-limit 10000

# Set status bar.
set-option -g status-bg "#05131a"
set-option -g status-fg "#4dc4ff"
set-option -g mode-style bg="#4dc4ff"
set-option -g mode-style fg="#05131a"
set-option -g status-justify 'left'
set-option -g window-status-separator ''
set-option -g status-left ""
set-option -g status-right-length 100
set-option -g status-right "#[fg=#33bbff,bg=#05131a] %a | %b %d | %R | #H"
set-option -g window-status-current-format "#[fg=#33bbff,bg=#05131a] [#I] #W "
set-option -g window-status-format "#[fg=#2483b3,bg=#05131a] [#I] #W "

# Ctrl-alt-arrow to switch window.
bind -n C-M-left previous-window
bind -n C-M-right next-window

# Ctrl-alt-shift-arrow to move window.
if-shell -b '[ "$(echo "$TMUX_VERSION < 3" | bc)" = 1 ]' " \
    bind -n C-M-S-left swap-window -t -1; \
    bind -n C-M-S-right swap-window -t +1; \
    bind -n C-M-S-pageup swap-window -t -1; \
    bind -n C-M-S-pagedown swap-window -t +1"

if-shell -b '[ "$(echo "$TMUX_VERSION >= 3" | bc)" = 1 ]' " \
    bind -n C-M-S-left swap-window -t -1\\; select-window -t -1; \
    bind -n C-M-S-right swap-window -t +1\\; select-window -t +1; \
    bind -n C-M-S-pageup swap-window -t -1\\; select-window -t -1; \
    bind -n C-M-S-pagedown swap-window -t +1\\; select-window -t +1"

# r to reload.
bind r source-file ~/.tmux.conf