Skip to content

Instantly share code, notes, and snippets.

@Rangozhang
Forked from atelic/tmux.conf
Last active September 7, 2025 05:08
Show Gist options
  • Save Rangozhang/88bfbade00a2eb270d97f18cac9c2c63 to your computer and use it in GitHub Desktop.
Save Rangozhang/88bfbade00a2eb270d97f18cac9c2c63 to your computer and use it in GitHub Desktop.
A vim-friendly tmux config
# Change prefix to Ctrl-a (like GNU screen)
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# Start with window 1
set -g base-index 1
# Start with pane 1
set -g pane-base-index 1
# Use screen-256color for compatibility
set -g default-terminal "screen-256color"
# Reload config with prefix + r
bind r source-file ~/.tmux.conf
# Set history limit
set -g history-limit 4096
# Allow terminal scrolling
set-option -g terminal-overrides 'xterm*:smcup@:rmcup@'
# Use vi-style key bindings
setw -g mode-keys vi
set -g status-keys vi
# Run custom script for zoom
bind C-z run "tmux-zoom.sh"
# Easy pane splitting
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
unbind '"'
unbind %
# Colon command prompt
bind : command-prompt
# Pane borders
set -g pane-border-style "fg=black"
set -g pane-active-border-style "fg=brightred"
# Movement between panes using hjkl
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Resize panes
bind-key -r J resize-pane -D 3
bind-key -r K resize-pane -U 3
bind-key -r H resize-pane -L 3
bind-key -r L resize-pane -R 3
# Status line appearance
set -g status-justify left
set -g status-interval 2
set -g status-style "fg=colour12,bg=default"
# Message style
set -g message-style "fg=black,bg=yellow,bold"
set -g message-command-style "fg=blue,bg=black"
# Window and mode styling
setw -g mode-style "fg=colour0,bg=colour6"
setw -g window-status-style "fg=black,bg=green,reverse"
setw -g window-status-current-style "fg=colour11,bg=colour0,dim"
setw -g window-status-format "#[fg=magenta]#[bg=black] #I #[bg=cyan]#[fg=colour8] #W "
setw -g window-status-current-format "#[bg=brightmagenta]#[fg=colour8] #I #[fg=colour8]#[bg=colour14] #W "
# Info on left
set -g status-left ''
# Silence alerts
set-option -g visual-activity off
set-option -g visual-bell off
set-option -g visual-silence off
set-window-option -g monitor-activity off
set-option -g bell-action none
# Clock color
setw -g clock-mode-colour colour135
set -g clock-mode-colour blue
# Keybindings for layout switching
bind x kill-pane
bind X next-layout
bind Z previous-layout
# Tab-like window switching
bind -n S-down new-window
bind -n S-left prev
bind -n S-right next
bind -n C-left swap-window -t -1
bind -n C-right swap-window -t +1
# Refined pane styling
set -g pane-border-style "fg=colour238,bg=colour235"
set -g pane-active-border-style "fg=colour51,bg=colour236"
# Refined status bar styling
set -g status-position bottom
set -g status-style "fg=colour137,bg=colour234,dim"
set -g status-left ''
set -g status-right '#[fg=colour233,bg=colour241,bold] %d/%m #[fg=colour233,bg=colour245,bold] %H:%M:%S '
set -g status-right-length 50
set -g status-left-length 20
# Window status formatting (again for override clarity)
setw -g window-status-current-style "fg=colour81,bg=colour238,bold"
setw -g window-status-current-format ' #I#[fg=colour250]:#[fg=colour255]#W#[fg=colour50]#F '
setw -g window-status-style "fg=colour138,bg=colour235"
setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F '
# Bell notifications
setw -g window-status-bell-style "fg=colour255,bg=colour1,bold"
# Final message style override
set -g message-style "fg=colour232,bg=colour166,bold"
# Enable mouse support
set -g mouse on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment