225 lines
6.0 KiB
Bash
225 lines
6.0 KiB
Bash
# =============================================
|
|
# Tmux Configuration
|
|
# =============================================
|
|
|
|
# -----------------------------------------
|
|
# Core Settings (Fixing Pi's Warning)
|
|
# -----------------------------------------
|
|
|
|
# Enable extended keys for modified Enter keys to work properly
|
|
set -g extended-keys on
|
|
|
|
# Format for extended keys (csi-u required for Pi)
|
|
set -g extended-keys-format csi-u
|
|
|
|
# Enable true color support
|
|
set -g default-terminal "tmux-256color"
|
|
set -ag terminal-overrides ",xterm-256color:RGB"
|
|
|
|
# =============================================
|
|
# Theme Colors (generated by matugen)
|
|
# =============================================
|
|
source-file ~/.config/tmux/colors.conf
|
|
|
|
# Faster escape time (for vim/neovim)
|
|
set -sg escape-time 10
|
|
|
|
# Increase scrollback buffer size
|
|
set -g history-limit 50000
|
|
|
|
# Enable mouse support (scroll, select, resize)
|
|
set -g mouse on
|
|
|
|
# Start window and pane numbering at 1 (easier to reach)
|
|
set -g base-index 1
|
|
setw -g pane-base-index 1
|
|
|
|
# Renumber windows when one is closed
|
|
set -g renumber-windows on
|
|
|
|
# Allow focus events (for vim/neovim)
|
|
set -g focus-events on
|
|
|
|
# -----------------------------------------
|
|
# Prefix Key (Change from Ctrl+b to Ctrl+s)
|
|
# -----------------------------------------
|
|
|
|
unbind C-b
|
|
set -g prefix C-s
|
|
bind C-s send-prefix
|
|
|
|
# -----------------------------------------
|
|
# Window Management
|
|
# -----------------------------------------
|
|
|
|
# Create new window
|
|
bind c new-window -c "#{pane_current_path}"
|
|
|
|
# Split panes with | and - (more intuitive)
|
|
bind | split-window -h -c "#{pane_current_path}"
|
|
bind - split-window -v -c "#{pane_current_path}"
|
|
unbind '"'
|
|
unbind %
|
|
|
|
# Quick window switching with prefix + number
|
|
bind -r 1 select-window -t 1
|
|
bind -r 2 select-window -t 2
|
|
bind -r 3 select-window -t 3
|
|
bind -r 4 select-window -t 4
|
|
bind -r 5 select-window -t 5
|
|
bind -r 6 select-window -t 6
|
|
bind -r 7 select-window -t 7
|
|
bind -r 8 select-window -t 8
|
|
bind -r 9 select-window -t 9
|
|
|
|
# Swap windows left/right
|
|
bind -r < swap-window -t -1
|
|
bind -r > swap-window -t +1
|
|
|
|
# -----------------------------------------
|
|
# Pane Navigation (Vim-style)
|
|
# -----------------------------------------
|
|
|
|
# Move between panes with vim keys
|
|
bind h select-pane -L
|
|
bind j select-pane -D
|
|
bind k select-pane -U
|
|
bind l select-pane -R
|
|
|
|
# Zellij-style: Alt+arrows to navigate panes (no prefix!)
|
|
bind -n M-Left select-pane -L
|
|
bind -n M-Down select-pane -D
|
|
bind -n M-Up select-pane -U
|
|
bind -n M-Right select-pane -R
|
|
|
|
# Resize panes with prefix + hjkl
|
|
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
|
|
|
|
# -----------------------------------------
|
|
# Moving Panes (Zellij-like)
|
|
# -----------------------------------------
|
|
|
|
# Break pane into new window (pop out)
|
|
bind b break-pane
|
|
|
|
# Join pane from another window (bring in)
|
|
bind j command-prompt -p "join pane from window #:" "join-pane -s '%%'"
|
|
|
|
# Swap panes with directional keys
|
|
bind > swap-pane -D
|
|
bind < swap-pane -U
|
|
|
|
# Mark pane + swap with marked pane (advanced)
|
|
bind m select-pane -m # Mark current pane
|
|
bind M swap-pane # Swap with marked pane
|
|
|
|
# Move pane to another window by number
|
|
bind @ command-prompt -p "send pane to window #:" "join-pane -t ':%%'"
|
|
|
|
# Alt+Shift+Left/Right for previous/next window (Zellij-style tabs)
|
|
bind -n M-S-Left previous-window
|
|
bind -n M-S-Right next-window
|
|
|
|
# -----------------------------------------
|
|
# Layouts (Stacking-like)
|
|
# -----------------------------------------
|
|
|
|
# Cycle through layouts: even-horizontal, even-vertical, main-horizontal, main-vertical, tiled
|
|
bind Space next-layout
|
|
bind BSpace previous-layout
|
|
|
|
# Quick layout shortcuts
|
|
bind Enter select-layout tiled
|
|
bind M-1 select-layout even-horizontal
|
|
bind M-2 select-layout even-vertical
|
|
bind M-3 select-layout main-horizontal
|
|
bind M-4 select-layout main-vertical
|
|
|
|
# Note: Pane resize with H/J/K/L is defined in the resize section above
|
|
|
|
# -----------------------------------------
|
|
# Copy Mode (Vim-style)
|
|
# -----------------------------------------
|
|
|
|
setw -g mode-keys vi
|
|
|
|
# Enter copy mode with prefix + [
|
|
bind [ copy-mode
|
|
|
|
# v to start selection (like vim)
|
|
bind -T copy-mode-vi v send -X begin-selection
|
|
|
|
# y to yank (copy)
|
|
bind -T copy-mode-vi y send -X copy-selection-and-cancel
|
|
|
|
# Escape to exit copy mode
|
|
bind -T copy-mode-vi Escape send -X cancel
|
|
|
|
# -----------------------------------------
|
|
# Session Management
|
|
# -----------------------------------------
|
|
|
|
# Prefix + d to detach from session (keeps it running)
|
|
# Reattach with: tmux attach
|
|
|
|
# Prefix + s to list and switch sessions
|
|
bind s choose-session
|
|
|
|
# Prefix + $ to rename current session
|
|
bind $ command-prompt -I "#S" "rename-session '%%'"
|
|
|
|
# Prefix + , to rename current window
|
|
bind , command-prompt -I "#W" "rename-window '%%'"
|
|
|
|
# -----------------------------------------
|
|
# Status Bar
|
|
# -----------------------------------------
|
|
|
|
# Update status bar every second
|
|
set -g status-interval 1
|
|
|
|
# Position at bottom
|
|
set -g status-position bottom
|
|
|
|
# Status bar sizing
|
|
set -g status-left-length 40
|
|
set -g status-right-length 100
|
|
|
|
# Note: Colors are defined in ~/.config/tmux/colors.conf (generated by matugen)
|
|
# The theme file sets: status-style, status-left, status-right,
|
|
# window-status-format, window-status-current-format, pane borders, etc.
|
|
|
|
# -----------------------------------------
|
|
# Other Useful Bindings
|
|
# -----------------------------------------
|
|
|
|
# Prefix + r to reload config
|
|
bind r source-file ~/.tmux.conf \; display "Config reloaded!"
|
|
|
|
# Prefix + x to kill current pane (with confirmation)
|
|
bind x confirm-before -p "kill-pane #P? (y/n)" kill-pane
|
|
|
|
# Prefix + & to kill current window (with confirmation)
|
|
bind & confirm-before -p "kill-window #W? (y/n)" kill-window
|
|
|
|
# Synchronize all panes in current window (toggle)
|
|
bind S set synchronize-panes
|
|
|
|
# Zoom current pane (toggle full-screen for pane)
|
|
bind z resize-pane -Z
|
|
|
|
# -----------------------------------------
|
|
# Notification Settings
|
|
# -----------------------------------------
|
|
|
|
# Enable activity monitoring
|
|
setw -g monitor-activity on
|
|
set -g visual-activity off
|
|
|
|
# Bell settings
|
|
set -g bell-action any
|
|
set -g visual-bell off
|