colson-tmux
Version:
Colson Tmux: Tmux + ZSH for Software Engineers!
110 lines (88 loc) • 4.52 kB
Plain Text
# Tmux Configuration
# Comprehensive, modular configuration for enhanced terminal multiplexing
# Designed for productivity, readability, and cross-environment consistency
# ---- Environment and Path Management ----
tmux_dir="$HOME/.config/tmux"
tmux_plugins_dir="$HOME/.tmux/plugins"
# ---- Plugin Management ----
# Use Tmux Plugin Manager (TPM) for robust plugin handling
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible' # Sensible default configurations
# ---- Navigation and Integration ----
# Seamless navigation between tmux and vim/neovim
set -g @plugin 'christoomey/vim-tmux-navigator'
# ---- Productivity Plugins ----
# System clipboard integration
set -g @plugin 'tmux-plugins/tmux-yank'
# Session and Environment Persistence
set -g @plugin 'tmux-plugins/tmux-resurrect' # Save and restore tmux sessions
set -g @plugin 'tmux-plugins/tmux-continuum' # Automatic session saving
set -g @plugin 'tmux-plugins/tmux-online-status' # Internet connection monitoring
# ---- Resurrect and Continuum Configuration ----
set -g @resurrect-dir "$tmux_dir/resurrect"
set -g @resurrect-save 'S' # Keybinding to manually save session
set -g @resurrect-restore 'R' # Keybinding to manually restore session
set -g @continuum-restore 'on' # Automatic session restoration on tmux start
# ---- Theme Selection (Uncomment preferred theme) ----
# Supports multiple aesthetic themes for personalization
# set -g @plugin 'catppuccin/tmux'
# set -g @plugin 'rose-pine/tmux'
# set -g @plugin "nordtheme/tmux"
# set -g @plugin "janoamaral/tokyo-night-tmux"
# ---- Catppuccin Theme Configuration ----
set -g @catppuccin_flavour 'mocha' # Theme variant selection
set -g @catppuccin_status_background "none"
set -g @catppuccin_status_modules_right "application session date_time"
set -g @catppuccin_status_left_separator "null"
set -g @catppuccin_window_default_text "#{b:pane_current_path}"
set -g @catppuccin_window_current_text "#{b:pane_current_path}"
# ---- Terminal and Color Configuration ----
set-option -g default-terminal "screen-256color"
set-option -ga terminal-overrides ",xterm-256color:Tc" # True color support
# ---- Status Bar Configuration ----
# Highly customizable status bar with context-aware information
set-option -g status on
set-option -g status-interval 1 # Frequent updates
set-option -g status-style "bg=#1e1e2e,fg=#cdd6f4" # Aesthetic background and text
set-option -g status-left-length 50
set-option -g status-right-length 50
# Remove the left-most section (current working directory)
set-option -g status-left "" # This clears the left side completely
# Dynamic status right: Process, session, and timestamp
set-option -g status-right "#[fg=#f28fad]┃#[fg=#cdd6f4] #{b:pane_current_command} \
#[fg=#a6e3a1]┃#[fg=#cdd6f4,bold] [#S] \
#[fg=#89b4fa]┃#[fg=#cdd6f4] %H:%M %a, %Y-%m-%d"
# ---- Window and Pane Management ----
# Automatic window renaming based on current working directory
setw -g automatic-rename on
# Adjust window-status-format and window-status-current-format to include space between window number and current working directory
# Add space before the blue separator bar between window number and current working directory
# Use green color for the active window with current working directory
set-window-option -g window-status-format "#I #{b:pane_current_path} #[fg=#89b4fa]┃"
set-window-option -g window-status-current-format "#[fg=#a6e3a1]#I #{b:pane_current_path} #[fg=#89b4fa]┃"
# Pane border styling for enhanced visual separation
set-option -g pane-border-style "fg=#585b70"
set-option -g pane-active-border-style "fg=#f28fad"
# ---- Keybindings ----
# Leader key: ctrl+space for ergonomic control
unbind C-b
set -g prefix C-Space
bind C-Space send-prefix
# Enhanced window navigation
bind -n M-K previous-window
bind -n M-J next-window
# Vim-style copy mode for familiar interaction
set-window-option -g mode-keys vi
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel
# Intelligent pane splitting with current path preservation
bind - split-window -vc "#{pane_current_path}"
bind | split-window -hc "#{pane_current_path}"
# Custom workflow bindings
bind-key o run-shell "tmux send-keys -t . 'bash ~/.config/tmux/goto.sh' Enter"
bind r command-prompt "rename-window %%"
bind s choose-tree -Z
# ---- Plugin Management ----
# Initialize TMUX plugin manager
run "$tmux_plugins_dir/tpm/tpm"