Files
dotfiles/tmux/tmux.conf

225 lines
6.6 KiB
Bash

# ============================================
# TMUX CONFIGURATION - CLEAN GRUVBOX
# ============================================
# ============================================
# TERMINAL & ENVIRONMENT
# ============================================
# Terminal settings
set -g allow-passthrough on
set -ga update-environment TERM
set -ga update-environment TERM_PROGRAM
set -g default-terminal "xterm-256color"
set-option -ga terminal-overrides ",xterm-kitty:Tc,*:Tc,*:RGB"
# Shell configuration
set -g default-shell /bin/zsh
set -g default-command /bin/zsh
# Environment variables for proper shell integration
set -ga update-environment KITTY_WINDOW_ID
set -ga update-environment KITTY_PID
set -ga update-environment XDG_CONFIG_HOME
set -ga update-environment ZDOTDIR
# ============================================
# GENERAL SETTINGS
# ============================================
# Start windows and panes at 1, not 0
set -g base-index 1
setw -g pane-base-index 1
# Renumber windows when one is closed
set -g renumber-windows on
# Increase scrollback buffer size
set -g history-limit 10000
# Enable automatic renaming for nerd font icons
set-option -g allow-rename on
set-option -g automatic-rename on
# Reduce escape time for neovim
set -sg escape-time 0
# Enable focus events
set -g focus-events on
# Show pane numbers longer
set -g display-panes-time 2000
# Show messages longer
set -g display-time 2000
# Aggressive resize for multiple clients
setw -g aggressive-resize on
# ============================================
# VI-LIKE KEYBINDINGS
# ============================================
# Vi mode
setw -g mode-keys vi
set -g status-keys vi
# Smart pane switching with awareness of Vim splits
is_vim="ps -o state= -o comm= -t '#{pane_tty}' | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
# Vi-like pane resizing
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# Vi-like copy mode
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel
bind-key -T copy-mode-vi 'r' send -X rectangle-toggle
# Enter copy mode with Escape
bind Escape copy-mode
# ============================================
# PANE MANAGEMENT
# ============================================
# Split panes with v and s (vi-like)
bind v split-window -h -c "#{pane_current_path}"
bind s split-window -v -c "#{pane_current_path}"
unbind '"'
unbind %
# New window in current path
bind c new-window -c "#{pane_current_path}"
# Quick pane cycling
bind -r C-h select-window -t :-
# bind -r C-l select-window -t :+
# Kill pane without confirmation
bind x kill-pane
# Kill window without confirmation
bind X kill-window
# Toggle zoom
bind z resize-pane -Z
# Flash currently active pane border (helpful when visually lost)
bind Space display-message "Active pane: #P (#{pane_current_command})"
# Synchronize panes with status message
bind y set-window-option synchronize-panes \; display-message "Synchronize panes #{?synchronize-panes,ON,OFF}"
# Quick session switching
bind S choose-tree -sZ -O name
# Create new session
bind N command-prompt -p "New session name:" "new-session -d -s '%%'"
# ============================================
# MOUSE SUPPORT
# ============================================
set -g mouse on
# Don't jump to bottom when mouse selecting
unbind -T copy-mode-vi MouseDragEnd1Pane
# URL handling - enable clickable URLs
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-urlview'
# Nerd font window name plugin
set -g @plugin 'joshmedeski/tmux-nerd-font-window-name'
# Mouse click behavior - simple pane selection without copy-mode
bind-key -T copy-mode-vi MouseDown1Pane select-pane
bind-key -T copy-mode MouseDown1Pane select-pane
bind-key -n MouseDown1Pane select-pane -t =
# ============================================
# GRUVBOX STYLING
# ============================================
# Status bar position
set -g status-position top
# Status bar styling
set -g status-style "bg=#3c3836,fg=#ebdbb2"
set -g status-left-length 100
set -g status-right-length 100
# Pane borders (strong active contrast)
set -g pane-border-style "fg=#3c3836"
set -g pane-active-border-style "fg=#fabd2f,bold"
# Show pane labels on borders for easier focus tracking
set -g pane-border-status top
set -g pane-border-format "#{?pane_active,#[fg=#282828,bg=#fabd2f,bold] ACTIVE #[default],#[fg=#928374] pane #[default]}#[fg=#ebdbb2] #P #[fg=#928374]| #[fg=#83a598]#{pane_current_command} #[fg=#928374]| #[fg=#bdae93]#{pane_current_path}"
# Message styling
set -g message-style "bg=#d79921,fg=#282828,bold"
set -g message-command-style "bg=#d79921,fg=#282828,bold"
# Mode styling
set -g mode-style "bg=#d79921,fg=#282828,bold"
# Colorful window status styling
set -g window-status-style "fg=#a89984,bg=#3c3836"
set -g window-status-format "#[fg=#282828,bg=#504945] #I #[fg=#a89984,bg=#3c3836] #W #[fg=#3c3836,bg=default]"
# Current window status (powerline highlight)
set -g window-status-current-style "fg=#282828,bg=#fabd2f,bold"
set -g window-status-current-format "#[fg=#282828,bg=#fabd2f,bold] #I #[fg=#282828,bg=#d79921,bold] #W #[fg=#d79921,bg=default]"
# Status bar content
set -g status-left "#[fg=#282828,bg=#d79921,bold] 󰅬 #S #[fg=#d79921,bg=#3c3836]"
set -g status-right "#[fg=#a89984] %H:%M #[fg=#d79921,bg=#3c3836]#[fg=#282828,bg=#d79921] %d %b "
# Status bar separators
set -g window-status-separator ""
set -g status-justify left
set -g status-interval 1
# Activity monitoring
set -g monitor-activity on
set -g visual-activity off
set -g activity-action other
# Bell settings
set -g monitor-bell on
set -g visual-bell off
set -g bell-action any
# Clock colors
set -g clock-mode-colour "#d79921"
set -g clock-mode-style 24
# Optionally also dim inactive windows further
set -g window-status-style "fg=#928374,bg=#3c3836"
# ============================================
# TRANSPARENCY SETTINGS
# ============================================
# Make pane backgrounds transparent
set -g window-style "bg=default"
set -g window-active-style "bg=default"
# ============================================
# RELOAD CONFIG
# ============================================
# Reload config file with message
bind r source-file ~/.config/tmux/tmux.conf \; display-message "󰑓 Config reloaded!"
# Initialize TMUX plugin manager (keep this line at the very bottom)
run '~/.config/tmux/plugins/tpm/tpm'