tmux/.config/tmux/tmux.conf
# ██████████ ████ ████ ██ ██ ██ ██
# ░░░░░██░░░ ░██░██ ██░██░██ ░██░░██ ██
# ░██ ░██░░██ ██ ░██░██ ░██ ░░██ ██
# ░██ ░██ ░░███ ░██░██ ░██ ░░███
# ░██ ░██ ░░█ ░██░██ ░██ ██░██
# ░██ ░██ ░ ░██░██ ░██ ██ ░░██
# ░██ ░██ ░██░░███████ ██ ░░██
# ░░ ░░ ░░ ░░░░░░░ ░░ ░░
#
# ▓▓▓▓▓▓▓▓▓▓
# ░▓ author ▓ xero <x@xero.style>
# ░▓ code ▓ https://code.x-e.ro/dotfiles
# ░▓ mirror ▓ https://git.io/.files
# ░▓▓▓▓▓▓▓▓▓▓
# ░░░░░░░░░░
# shell
set -g default-command /usr/bin/zsh
set -g default-shell /usr/bin/zsh
# screen mode
set -g default-terminal "screen-256color"
# start with window 1 (instead of 0)
set -g base-index 1
# renumber windows after closing
set -g renumber-windows on
# start with pane 1
set -g pane-base-index 1
# remove esc delay
set -sg escape-time 0
# history
set -g history-limit 10000
# allow terminal scrolling
set-option -g terminal-overrides 'xterm*:smcup@:rmcup@'
# use vi mode
setw -g mode-keys vi
set -g status-keys vi
# pleb mode
set -g mouse on
# panes
set -g pane-border-style "fg=color0"
set -g pane-active-border-style "fg=color0"
set -g window-active-style 'bg=terminal'
set -g window-style 'bg=color234'
# status line
set -g status-justify left
set -g status-style "bg=terminal,fg=color1"
set -g status-interval 2
# messaging
set -g message-style "bg=color1,fg=color0"
set -g message-command-style "bg=color1,fg=color1"
# window mode
setw -g mode-style "bg=color1,fg=color0"
# split sytle
set -g pane-border-style "bg=color234,fg=color234"
set -g pane-active-border-style "bg=color0,fg=color0"
#resizing
setw -g aggressive-resize on
# window status
set-option -g status-position bottom
setw -g window-status-format " #[bg=color1,fg=color0,noreverse]▓░ #W "
setw -g window-status-current-format " #[bg=color6,fg=color0,noreverse]▓░ #W "
# loud or quiet?
set-option -g visual-activity on
set-option -g visual-bell off
set-option -g visual-silence off
set-window-option -g monitor-activity off
set-option -g bell-action none
# tmux clock
set -g clock-mode-color color1
# change prefix to backtick
unbind C-b
set-option -g prefix `
bind ` send-prefix
# vim style copy paste mode
unbind [
bind escape copy-mode
unbind p
bind p paste-buffer
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel "xsel -i" \; send-keys enter
bind-key -T copy-mode-vi 'Y' send -X copy-pipe-and-cancel "tmux loadb -" \; send-keys enter
# splitting
unbind %
bind h split-window -v
unbind '"'
bind v split-window -h
# navigate and resize splits
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\S+\/)?g?(view|n?vim?x?)(diff)?$'"
bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind -n C-Left if-shell "$is_vim" "send-keys M-h" "resize-pane -L 2"
bind -n C-Right if-shell "$is_vim" "send-keys M-l" "resize-pane -R 2"
bind -n C-Up if-shell "$is_vim" "send-keys M-k" "resize-pane -U 2"
bind -n C-Down if-shell "$is_vim" "send-keys M-j" "resize-pane -D 2"
# zoom split
unbind z
bind z if-shell "$is_vim" "send-keys ,z" "resize-pane -Z"
bind Z resize-pane -Z
# vim style commands
bind : command-prompt
# source config file
bind r source-file ~/.config/tmux/tmux.conf
# other random key-binding changes
bind x kill-pane
bind t set status
bind a set-window-option synchronize-panes \; display-message "█▓░ synchronize"
# tmux plugins
set -g @plugin 'tmux-plugins/tpm'
setenv -g TMUX_PLUGIN_MANAGER_PATH '~/.config/tmux/plugins/'
# sticky fingers
set -g @plugin 'fcsonline/tmux-thumbs'
run-shell ~/.config/tmux/plugins/tmux-thumbs/tmux-thumbs.tmux
unbind f
set -g @thumbs-key f
set -g @thumbs-osc52 1
set -g @thumbs-contrast 1
set -g @thumbs-bg-color yellow
set -g @thumbs-fg-color black
set -g @thumbs-hint-bg-color red
set -g @thumbs-hint-fg-color black
set -g @thumbs-select-bg-color blue
set -g @thumbs-select-fg-color black
set -g @thumbs-command 'printf "{}" | yank && tmux send-keys enter'
# status icon
set -g @plugin 'MunifTanjim/tmux-mode-indicator'
set -g @mode_indicator_prefix_prompt ' ◈ '
set -g @mode_indicator_prefix_mode_style 'bg=blue,fg=black'
set -g @mode_indicator_copy_prompt ' '
set -g @mode_indicator_copy_mode_style 'bg=yellow,fg=black'
set -g @mode_indicator_sync_prompt ' '
set -g @mode_indicator_sync_mode_style 'bg=blue,fg=black'
set -g @mode_indicator_empty_prompt ' ◇ '
set -g @mode_indicator_empty_mode_style 'bg=black,fg=cyan'
# status line
set -g status-right-length 100
set -g status-right '#(~/.local/bin/tmux-status)'
set -g status-left '#{tmux_mode_indicator}'
# enable OSC 52 clipboard
set -s set-clipboard on
# Ms modifies OSC 52 clipboard handling to work with mosh, see
# https://gist.github.com/yudai/95b20e3da66df1b066531997f982b57b
set -ag terminal-overrides "vte*:XT:Ms=\E]52;c;%p2%s,xterm*:XT:Ms=\E]52;c;%p2%s"
unbind p
bind p paste-buffer -p
# clipboard menu
bind space display-popup -w 70% -h 70% -E "CM_OUTPUT_CLIP=1 clipmenu | yank"
# emoji menu
bind e display-popup -w 70% -h 70% -E "emoji"
run '~/.config/tmux/plugins/tpm/tpm'