Files
dotfiles/.config/tmux/tmux.conf

100 lines
2.7 KiB
Bash

### General Settings
# Mouse support
set -g mouse on
# Terminal type
set -g default-terminal "tmux-256color"
# Window base index
set -g base-index 1
# Pane base index
setw -g pane-base-index 1
# History limit
set-option -g history-limit 10000
### Startup Configuration
# Ensure main session exists and setup startup layout
if-shell 'tmux has-session -t main 2>/dev/null' '' 'new-session -ds main; send-keys -t main:1 "htop" C-m; split-window -t main:1'
### Key Bindings
# Prefix key
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# Pane splits
bind "h" split-window -h
bind "v" split-window -v
unbind '"'
unbind %
# Reload config
bind r source-file $XDG_CONFIG_HOME/tmux/tmux.conf \; display-message "tmux config reloaded"
### Clipboard Integration
# Clipboard
set -s set-clipboard on
set -ag terminal-overrides ",*:Ms=\\E]52;c;%p2%s\\7"
# Copy mode
setw -g mode-keys vi
# Copy bindings
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "$XDG_CONFIG_HOME/tmux/yank.sh"
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "$XDG_CONFIG_HOME/tmux/yank.sh"
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "$XDG_CONFIG_HOME/tmux/yank.sh"
### Status and Window Configuration
# Status interval
set -g status-interval 1
# Auto rename
set-option -g automatic-rename on
# Rename format
set-option -g automatic-rename-format '#{?#{==:#{pane_current_command},zsh},#(echo #{pane_current_path} | sed "s|^$HOME|~|"),#{pane_current_command}}'
# Clock color
set -g clock-mode-colour "#8bd5ca"
# Copy mode style
set -g mode-style 'fg=black bg=#ed8796 bold'
# Pane borders
set -g pane-border-style 'fg=white'
set -g pane-active-border-style 'fg=#8bd5ca'
### Status Bar Configuration
# Status position
set -g status-position bottom
# Status justify
set -g status-justify left
# Status style
set -g status-style 'fg=white,bg=#262626'
# Clear status left
set -g status-left ''
# Status left length
set -g status-left-length 30
# Session and prefix
set -ga status-left '#[fg=#cad3f5,bg=#1e1e2e] #S #[fg=#{?client_prefix,#f38ba8,#585b70}]● '
# Window tabs
setw -g window-status-format '#[fg=#cdd6f4,bg=#313244] #I: #W #[fg=#cdd6f4,bg=#1e1e2e] '
setw -g window-status-current-format '#[fg=#1e1e2e,bg=#cba6f7,bold] #I: #W #[fg=#cdd6f4,bg=#1e1e2e,nobold] '
# Window separator
set -g window-status-separator ''
# Status right
set -g status-right ''
set -g status-right-length 50
set -ga status-right '#{?SSH_CONNECTION,#[fg=#1e1e2e#,bg=#fab387#,bold] SSH #[fg=#cdd6f4#,bg=#1e1e2e#,nobold] ,}'
set -ga status-right '#[fg=#1e1e2e,bg=#94e2d5,bold] #H #[fg=#cdd6f4,bg=#1e1e2e,nobold]'