85 lines
3.3 KiB
Bash
85 lines
3.3 KiB
Bash
# Enable 256-color and true-color (24-bit) support in tmux
|
|
set -g default-terminal "tmux-256color" # Use tmux-256color for proper undercurl/italic support
|
|
set -ga terminal-overrides ",*256col*:Tc" # Override to enable true-color for compatible terminals
|
|
|
|
# General
|
|
set -g set-clipboard on # Use system clipboard
|
|
set -g detach-on-destroy off # Don't exit from tmux when closing a session
|
|
set -g escape-time 10 # Low delay for ESC (0 can cause escape sequence issues)
|
|
set -g history-limit 1000000 # Increase history size (from 2,000)
|
|
set -g mouse on # Enable mouse support
|
|
set -g status-interval 3 # Update the status bar every 3 seconds (default: 15 seconds)
|
|
set -g allow-passthrough off # Avoid terminal state corruption from passthrough escape sequences
|
|
set -g status-position bottom
|
|
set -g focus-events on # Enable focus events for Neovim autoread/FocusGained
|
|
|
|
# Set prefix key
|
|
unbind C-b # Unbind the default prefix key
|
|
set -g prefix C-Space # Set new prefix key to Ctrl+Space
|
|
set -g prefix2 C-b # Fallback to original tmux prefix
|
|
|
|
# Refresh tmux config with r
|
|
unbind r
|
|
bind r source-file ~/.config/tmux/tmux.conf
|
|
|
|
# Split horizontally in CWD with \
|
|
unbind %
|
|
bind \\ split-window -h -c "#{pane_current_path}"
|
|
|
|
# Split vertically in CWD with -
|
|
unbind \"
|
|
bind - split-window -v -c "#{pane_current_path}"
|
|
|
|
# New window in same path
|
|
bind c new-window -c "#{pane_current_path}"
|
|
|
|
# Use vim arrow keys to resize
|
|
bind -r j resize-pane -D 5
|
|
bind -r k resize-pane -U 5
|
|
bind -r l resize-pane -R 5
|
|
bind -r h resize-pane -L 5
|
|
|
|
# Use m key to maximize pane
|
|
bind -r m resize-pane -Z
|
|
|
|
# vim-tmux-navigator captures plain Ctrl+l for pane navigation, which breaks
|
|
# the shell's clear-screen. Restore it as "Prefix + Ctrl+l".
|
|
bind C-l send-keys 'C-l'
|
|
|
|
# Enable vi mode to allow us to use vim keys to move around in copy mode (Prefix + [ places us in copy mode)
|
|
set-window-option -g mode-keys vi
|
|
set -g @yank_selection_mouse 'clipboard' # Fix mouse drag copy behavior
|
|
|
|
# Paste yanked text with "Prefix + P" ("Prefix + p" goes to previous window)
|
|
bind P paste-buffer
|
|
|
|
# Start windows and panes at 1, not 0
|
|
set -g base-index 1
|
|
set -g pane-base-index 1
|
|
set -g renumber-windows on # Automatically renumber windows when one is closed
|
|
|
|
# tpm plugin manager
|
|
set -g @plugin 'tmux-plugins/tpm'
|
|
|
|
# List of tmux plugins
|
|
set -g @plugin 'christoomey/vim-tmux-navigator' # Enable navigating between nvim and tmux
|
|
set -g @plugin 'tmux-plugins/tmux-resurrect' # Persist tmux sessions after computer restart
|
|
set -g @plugin 'tmux-plugins/tmux-continuum' # Automatically saves sessions every 15 minutes
|
|
set -g @plugin 'hendrikmi/tmux-cpu-mem-monitor' # CPU and memory info
|
|
set -g @plugin 'tmux-plugins/tmux-yank'
|
|
|
|
# Load theme from deterministic selector file generated during shell startup.
|
|
if-shell '[ -f ~/.cache/dotfiles/tmux-theme.conf ]' \
|
|
'source-file ~/.cache/dotfiles/tmux-theme.conf' \
|
|
'source-file ~/.config/tmux/dragon-theme.conf'
|
|
|
|
# Resurrect
|
|
set -g @resurrect-capture-pane-contents 'on'
|
|
# set -g @continuum-restore 'on'
|
|
|
|
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
|
|
run '~/.tmux/plugins/tpm/tpm'
|
|
|
|
# NOTE:
|
|
# - To apply theme changes: tmux kill-server && rm -rf /tmp/tmux-*
|
|
# - To avoid overlap, disable the Mac shortcut to switch input sources with Ctrl+Space in `System settings > Keyboard Shortcuts > Input Sources`
|