Skip to content

Instantly share code, notes, and snippets.

@shitcoding
Last active March 27, 2022 12:33
Show Gist options
  • Save shitcoding/2762e79e6805d68f586489ee5048f5e0 to your computer and use it in GitHub Desktop.
Save shitcoding/2762e79e6805d68f586489ee5048f5e0 to your computer and use it in GitHub Desktop.
The best of the best Tmux config ever
##########################################################################
##### Key Bindings ####################################################
##########################################################################
# Note:
# `<Prefix>+key`: simultaneously press <Prefix> and key
# `<Prefix> key`: press <Prefix> and then press the key
# Bind <Prefix> to Ctrl+A instead of Ctrl+B
unbind C-b
set -g prefix C-a
# Use Vim hjkl keys for moving between windows and resizing panes
setw -g mode-keys vi
# `<Prefix> hjkl`: switch between panes
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# `<Alt>+hjkl` (without <Prefix>): switch between panes
bind -n M-h select-pane -L
bind -n M-j select-pane -D
bind -n M-k select-pane -U
bind -n M-l select-pane -R
# `<Alt>+z` (without <Prefix>): zoom current pane
bind -n M-z resize-pane -Z
# Enter copy/yank mode with `<Prefix> Enter` instead of `<Prefix> [`
unbind [
bind Enter copy-mode
# Vim keys in copypaste/yank mode (hjkl, v, y)
set-window-option -g mode-keys vi
bind -T copy-mode-vi v send -X begin-selection
bind -T copy-mode-vi y send -X copy-selection
# window navigation ___________________________________________
unbind n
unbind p
# `<Prefix>+h`: select previous window (next to the left)
bind -r C-h previous-window
# `<Prefix>+l`: select next window (next to the right)
bind -r C-l next-window
# `<Prefix> tab`: switch to the last active window
bind Tab last-window
# `<Prefix>+k`: move the current window to the left in windows list
bind -r C-k swap-window -t -1 \; previous-window
# `<Prefix>+j`: move the current window to the right in windows list
bind -r C-j swap-window -t +1 \; next-window
#______________________________________________________________
# `<Prefix> r`: reload .tmux.conf config
bind r source-file ~/.tmux.conf \; display '~/.tmux.conf sourced'
##########################################################################
##########################################################################
#### General Settings ####################################################
##########################################################################
set -g history-limit 5000 # boost history
set -g base-index 1 # start windows numbering from 1 instead of 0
setw -g pane-base-index 1 # start panes numbering from 1 instead of 0
##########################################################################
##########################################################################
############### Begin TPM Plugin Manager Settings ####################
##########################################################################
# List of plugins
set -g @plugin 'tmux-plugins/tpm' # TPM plugin manager
# A set of sensible tmux options
set -g @plugin 'tmux-plugins/tmux-sensible'
# tmux-yank - yank to system clipboard in copy mode
set -g @plugin 'tmux-plugins/tmux-yank'
# Save and restore tmux sessions and windows
# `<Prefix> <Ctrl>+s` to save
# `<Prefix> <Ctrl>+r` to restore
set -g @plugin 'tmux-plugins/tmux-resurrect'
# Initialize TMUX plugin manager
run '~/.tmux/plugins/tpm/tpm'
##########################################################################
##### End of TPM Plugin Manager Settings #####################
##########################################################################
##########################################################################
##### Color Scheme Settings (modified Gruvbox theme) #################
##########################################################################
# window separators
set-option -wg window-status-separator ""
# monitor window changes
set-option -wg monitor-activity on
set-option -wg monitor-bell on
# set statusbar update interval
set-option -g status-interval 1
### colorscheme ######################################################
# change window screen colors
set-option -wg mode-style bg="#FE8019",fg="#3C3836"
# default statusbar colors (terminal bg should be #282828)
set-option -g status-style bg=terminal,fg="#A89984"
# default window title colors
set-option -wg window-status-style bg="#3C3836",fg="#7C6F64"
# colors for windows with activity
set-option -wg window-status-activity-style bg="#3C3836",fg="#A89984"
# colors for windows with bells
set-option -wg window-status-bell-style bg="#3C3836",fg="#FE8019"
# active window title colors
set-option -wg window-status-current-style bg="#FE8019",fg="#3C3836"
# pane border
set-option -g pane-active-border-style fg="#FE8019"
set-option -g pane-border-style fg="#3C3836"
# message info
set-option -g message-style bg="#FE8019",fg="#3C3836"
# writing commands inactive
set-option -g message-command-style bg="#A89984",fg="#3C3836"
# pane number display
set-option -g display-panes-active-colour "#FE8019"
set-option -g display-panes-colour "#3C3836"
# clock
set-option -wg clock-mode-colour "#FE8019"
# copy mode highlighting
%if #{>=:#{version},3.2}
set-option -wg copy-mode-match-style "bg=#A89984,fg=#3C3836"
set-option -wg copy-mode-current-match-style "bg=#FE8019,fg=#3C3836"
%endif
# statusbar formatting
# "#fe8019" MUST be in lowercase here (conflicts with statusline alias otherwise)
set-option -g status-left "#[bg=#A89984, fg=#3C3836]#{?client_prefix,#[bg=#fe8019],#[bg=#A89984]} #{session_name} "
set-option -g status-right "#[bg=#3C3836, fg=#7C6F64] %Y-%m-%d %H:%M:%S #[bg=#A89984, fg=#3C3836]#{?client_prefix,#[bg=#fe8019],#[bg=#A89984]} #{host_short} "
set-option -wg window-status-current-format "#{?window_zoomed_flag,#[fg=default bold],#[fg=default]} #{window_index} #{window_name} "
set-option -wg window-status-format "#{?window_zoomed_flag,#[fg=default bold],#[fg=default]} #{window_index} #{window_name} "
##########################################################################
##### End of Color Scheme Settings ##################################
##########################################################################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment