Skip to content

Instantly share code, notes, and snippets.

@f0ster
Last active May 12, 2024 01:22
Show Gist options
  • Save f0ster/281cc8232b8e3f5ab8dd3c148429bd2b to your computer and use it in GitHub Desktop.
Save f0ster/281cc8232b8e3f5ab8dd3c148429bd2b to your computer and use it in GitHub Desktop.
modern osx tmux conf
# ~/.tmux.conf
# General settings
set -g default-terminal "screen-256color" # Use 256-color terminal
set -g history-limit 5000 # Increase scrollback buffer size
set -g base-index 0 # Start window indexes at 0
set -g mouse on # Enable mouse control (pane selection, resizing, scrolling)
# Restore original prefix key
set-option -g prefix C-b # Set prefix to Ctrl-b
bind-key C-b send-prefix # Send the prefix to client inside window
# Status bar
set -g status-interval 5 # Status bar update interval
set -g status-justify left # Left-justify window list in status bar
setw -g window-status-format "#I:#W#F" # Window list format
setw -g window-status-current-format "#[bold]#I:#W#F" # Active window format
# Appearance
setw -g mode-keys vi # Use vi-style keybindings in copy mode
set -g status-keys vi # Use vi-style keybindings in status line
# Mouse support in copy mode
setw -g mouse on # Enable mouse in copy mode and pane resizing, selection
# Splits and windows
bind-key | split-window -h # Horizontal split
bind-key - split-window -v # Vertical split
bind-key c new-window # Create new window
bind-key n next-window # Move to the next window
bind-key p previous-window # Move to the previous window
# Copy and paste
bind-key -T copy-mode-vi 'v' send -X begin-selection # Begin selection in copy mode
bind-key -T copy-mode-vi 'y' send -X copy-selection-and-cancel # Yank selection and exit copy mode
bind-key -T prefix ] paste-buffer # Paste buffer
# Navigation using arrow keys for panes and windows
bind-key -n "C-Left" select-window -t :- # Ctrl-Left to select previous window
bind-key -n "C-Right" select-window -t :+ # Ctrl-Right to select next window
bind-key -n "C-Up" select-pane -U # Ctrl-Up to select the pane above
bind-key -n "C-Down" select-pane -D # Ctrl-Down to select the pane below
# Resizing panes
bind-key -r H resize-pane -L 5 # Resize pane left
bind-key -r J resize-pane -D 5 # Resize pane down
bind-key -r K resize-pane -U 5 # Resize pane up
bind-key -r L resize-pane -R 5 # Resize pane right
# Detach, reload, and other bindings
bind-key d detach # Detach session
bind-key R source-file ~/.tmux.conf \; display-message "Config reloaded!" # Reload tmux config
bind-key x confirm-before "kill-pane" # Kill current pane
bind-key X confirm-before "kill-window" # Kill current window
# Default statusbar colors
set -g status-style fg=white,bg=default
setw -g window-status-style fg=white,bg=default,dim
setw -g window-status-current-style fg=cyan,bg=default,underscore
# Automatically adjust window size when pane is added or closed
setw -g aggressive-resize on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment