Created
June 2, 2025 14:05
-
-
Save madebycm/b9be5b01d310adaf5f05a36fe65697c1 to your computer and use it in GitHub Desktop.
tmux split + auto start
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# @author madebycm (2025-06-02) | |
# tmux configuration - streamlined setup for macOS Terminal | |
# ==================== | |
# PREFIX KEY | |
# ==================== | |
# Change prefix from default Ctrl+B to Ctrl+Space for easier access | |
set -g prefix C-Space | |
unbind C-b | |
bind C-Space send-prefix | |
# ==================== | |
# PANE MANAGEMENT | |
# ==================== | |
# Unbind default split keys | |
unbind '"' | |
unbind % | |
# Intuitive split bindings: | |
bind - split-window -h # Ctrl+Space + - = vertical split (side by side) | |
bind h split-window -v # Ctrl+Space + h = horizontal split (top/bottom) | |
# Switch between panes: | |
bind j select-pane -L # Ctrl+Space + j = left pane | |
bind k select-pane -R # Ctrl+Space + k = right pane | |
bind i select-pane -U # Ctrl+Space + i = up pane | |
bind o select-pane -D # Ctrl+Space + o = down pane | |
# Resize panes (repeatable - hold prefix once, then press arrows multiple times): | |
bind -r Left resize-pane -L 5 # Ctrl+Space + Left = shrink left | |
bind -r Right resize-pane -R 5 # Ctrl+Space + Right = grow right | |
bind -r Up resize-pane -U 5 # Ctrl+Space + Up = shrink up | |
bind -r Down resize-pane -D 5 # Ctrl+Space + Down = grow down | |
# ==================== | |
# MOUSE & DISPLAY | |
# ==================== | |
# Enable mouse support (click to switch panes, drag to resize) | |
set -g mouse on | |
# Better colors | |
set -g default-terminal "screen-256color" | |
# Start windows and panes at 1 instead of 0 (easier to reach on keyboard) | |
set -g base-index 1 | |
setw -g pane-base-index 1 | |
# ==================== | |
# UTILITIES | |
# ==================== | |
# Reload config file | |
bind r source-file ~/.tmux.conf \; display-message "Config reloaded!" | |
# ==================== | |
# AUTO-START SETUP | |
# ==================== | |
# To auto-start tmux when opening Terminal, add this to ~/.zshrc: | |
# | |
# # Auto-start tmux | |
# if [ -z "$TMUX" ] && [ ${UID} != 0 ] && [[ $- == *i* ]]; then | |
# tmux source-file ~/.tmux.conf 2>/dev/null || true | |
# tmux new-session -A -s main | |
# fi | |
# | |
# This will: | |
# - Auto-reload this config file on terminal start | |
# - Create/attach to a session called "main" | |
# - Only run for interactive shells (not scripts or root) | |
# ==================== | |
# QUICK REFERENCE | |
# ==================== | |
# Ctrl+Space + - : vertical split | |
# Ctrl+Space + h : horizontal split | |
# Ctrl+Space + j/k/i/o : switch panes (left/right/up/down) | |
# Ctrl+Space + arrows : resize panes | |
# Ctrl+Space + r : reload config | |
# Mouse: click panes to switch, drag borders to resize |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment