Files

143 lines
5.6 KiB
Bash

# ==============================================================================
# 1. TPM PLUGINS
# ==============================================================================
set -g @plugin 'tmux-plugins/tmux-battery'
set -g @plugin 'tmux-plugins/tmux-cpu'
# Battery plugin icon tiers & status overrides (Nerd Fonts v3)
set -g @batt_icon_charge_tier8 '󰁹'
set -g @batt_icon_charge_tier7 '󰂁'
set -g @batt_icon_charge_tier6 '󰁿'
set -g @batt_icon_charge_tier5 '󰁾'
set -g @batt_icon_charge_tier4 '󰁽'
set -g @batt_icon_charge_tier3 '󰁼'
set -g @batt_icon_charge_tier2 '󰁺'
set -g @batt_icon_charge_tier1 '󰁹'
set -g @batt_icon_status_charged '󰂄'
set -g @batt_icon_status_charging '󰂄'
set -g @batt_icon_status_attached '󰂄'
set -g @batt_icon_status_discharging '󰁽'
set -g @batt_icon_status_unknown '󰂑'
# CPU & RAM plugin format
set -g @cpu_percentage_format "%2d%%"
set -g @ram_percentage_format "%2d%%"
# ==============================================================================
# 2. KEYBINDINGS
# ==============================================================================
# Prefix key: Use C-a (like GNU screen)
unbind C-b
unbind l
set -g prefix C-a
bind-key C-a last-window
bind-key a send-prefix
# Config reload
bind r source-file ~/.config/tmux/tmux.conf
# Window & pane splitting (open in current working directory)
unbind %
bind | split-window -c '#{pane_current_path}' -h
bind - split-window -c '#{pane_current_path}' -v
bind c new-window -c '#{pane_current_path}'
# Pane navigation (vim-style)
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Toggle status bar visibility
bind t set-option status
# ==============================================================================
# 3. TERMINAL CAPABILITIES & INTEGRATION
# ==============================================================================
set -g default-terminal 'tmux-256color'
# Truecolor / RGB support for outside terminals (Ghostty, WezTerm, xterm)
set -as terminal-overrides ',xterm-256color:Tc'
set -as terminal-overrides ',xterm-ghostty:Tc'
set -as terminal-features ',*:RGB'
# Terminal features & modern sequence passthroughs
set -s extended-keys on
set -s extended-keys-format csi-u
set -as terminal-features 'xterm*:extkeys'
set -as terminal-features ',*:osc11'
set -as terminal-features ',xterm-ghostty:progressbar'
set -g allow-passthrough on
# Fast escape sequences (eliminates delay in Neovim)
set -g escape-time 10
# Forward focus events so Neovim re-queries backgrounds/buffers
set -g focus-events on
# ==============================================================================
# 4. WINDOW & PANE SETTINGS
# ==============================================================================
set -g mouse on
set -g history-limit 1000
# Vi navigation in copy/status modes
setw -g mode-keys vi
set -g status-keys vi
# Window indexing & naming
set -g status-interval 5
set -g automatic-rename on
set -g renumber-windows on
set -g set-titles on
set -g set-titles-string "#T"
# Activity alerts
setw -g monitor-activity on
set -g visual-activity on
# ==============================================================================
# 5. STATUS BAR & DYNAMIC THEMING
# ==============================================================================
set -g status "on"
set -g status-position bottom
set -g status-justify "left"
set -g status-left-length 80
set -g status-right-length 80
set -g status-left-style "none"
set -g status-right-style "none"
setw -g window-status-separator ""
setw -g window-status-activity-style "none"
# Powerline format strings (resolves @theme_* user options dynamically)
set -g status-left "#[fg=#{@theme_status_fg},bg=#{@theme_status_bg},bold] #S #[fg=#{@theme_status_bg},bg=#{@theme_bg},nobold,nounderscore,noitalics]"
set -g status-right "#[fg=#{@theme_info_bg},bg=#{@theme_bg},nobold,nounderscore,noitalics]#[fg=#{@theme_info_fg},bg=#{@theme_info_bg}] 󰍛 #{cpu_percentage} #[fg=#{@theme_bg},bg=#{@theme_info_bg},nobold,nounderscore,noitalics]#[fg=#{@theme_info_fg},bg=#{@theme_bg}] 󰘚 #{ram_percentage} #[fg=#{@theme_info_bg},bg=#{@theme_bg},nobold,nounderscore,noitalics]#[fg=#{@theme_info_fg},bg=#{@theme_info_bg}] #{battery_icon} #{battery_percentage} #[fg=#{?#{||:#{client_prefix},#{pane_in_mode}},#{@theme_window_bg},#{@theme_bg}},bg=#{@theme_info_bg},nobold,nounderscore,noitalics]#[fg=#{?#{||:#{client_prefix},#{pane_in_mode}},#{@theme_window_fg},#{@theme_info_fg}},bg=#{?#{||:#{client_prefix},#{pane_in_mode}},#{@theme_window_bg},#{@theme_bg}},#{?#{||:#{client_prefix},#{pane_in_mode}},bold,nobold}] #{?client_prefix,PREFIX,#{?pane_in_mode,#{pane_mode},#h}} "
setw -g window-status-format "#[fg=#{@theme_window_info_fg},bg=#{@theme_bg}] #I:#P #[fg=#{@theme_window_info_fg},bg=#{@theme_bg}] #T "
setw -g window-status-current-format "#[fg=#{@theme_bg},bg=#{@theme_window_bg},nobold,nounderscore,noitalics]#[fg=#{@theme_window_fg},bg=#{@theme_window_bg}] #I:#P #[fg=#{@theme_window_fg},bg=#{@theme_window_bg}] #T #[fg=#{@theme_window_bg},bg=#{@theme_bg},nobold,nounderscore,noitalics]"
# Theme-switching hooks
set-hook -g client-dark-theme {
source-file ~/.config/tmux/themes/modus-vivendi-tinted.conf
}
set-hook -g client-light-theme {
source-file ~/.config/tmux/themes/modus-operandi-tinted.conf
}
if-shell -F '#{==:#{client_theme},light}' {
set-hook -gR client-light-theme
} {
set-hook -gR client-dark-theme
}
# ==============================================================================
# 6. TPM INITIALIZATION (MUST BE AT VERY BOTTOM)
# ==============================================================================
run '~/.local/share/tmux/plugins/tpm-redux/tpm'