Skip to content

Instantly share code, notes, and snippets.

@alejandrobernardis
Created May 26, 2025 02:54
Show Gist options
  • Save alejandrobernardis/675a3f7af3d12613cfdf64b6a9d9e73c to your computer and use it in GitHub Desktop.
Save alejandrobernardis/675a3f7af3d12613cfdf64b6a9d9e73c to your computer and use it in GitHub Desktop.
tmux
# common
set -g default-terminal 'tmux-256color'
set -as terminal-overrides ',*:Tc'
set -as terminal-features ',*:RGB'
set -g escape-time 1
set -g repeat-time 1000
set -g history-limit 100000
set -g bell-action none
set -g update-environment -r
set -g set-clipboard on
set -g visual-activity on
set -g monitor-activity on
set -g aggressive-resize on
# reload
unbind r
bind r source-file ~/.tmux.conf
# leader
unbind C-b
set -g prefix C-Space
bind C-Space send-prefix
# mouse
set -g mouse off
bind -T root MouseDrag1Border resize-pane -M \262\270\237\177
bind -T root MouseDown1Pane select-pane -t = \; send-keys -M =
bind -T root MouseDown1Status select-window -t =
bind -T root WheelUpStatus previous-window
bind -T root WheelDownStatus next-window
bind m set -g mouse on\; display-message 'Mouse mode: ON'
bind M set -g mouse off\; display-message 'Mouse mode: OFF'
# layout
set -g base-index 1
bind Space next-layout
bind E select-layout -E
bind M-1 select-layout even-horizontal
bind M-2 select-layout even-vertical
bind M-3 select-layout main-horizontal
bind M-4 select-layout main-vertical
bind M-5 select-layout tiled
# session
bind -n M-Q confirm-before -p "Kill session '#S'? (y/n)" kill-session
bind M-s command-prompt -p "Rename session:" -I '#S' 'rename-session %1'
bind s choose-session
bind q kill-session
# window
bind -n M-W confirm-before -p "Kill window '#W'? (y/N)" kill-window
bind M-w command-prompt -p "Rename window:" -I '#W' 'rename-window %1'
bind f command-prompt " find-window -Z -- '%%'"
bind -n M-1 select-window -t 1
bind -n M-2 select-window -t 2
bind -n M-3 select-window -t 3
bind -n M-4 select-window -t 4
bind -n M-5 select-window -t 5
bind -n M-6 select-window -t 6
bind -n M-7 select-window -t 7
bind -n M-8 select-window -t 8
bind -n M-9 select-window -t 9
bind -n M-0 select-window -t 10
bind -n M-v split-window -v -c "~/"
bind - split-window -v -c "#{pane_current_path}"
bind -n M-h split-window -h -c "~/"
bind = split-window -h -c "#{pane_current_path}"
bind -n M-\- previous-window
bind -n M-PageUp previous-window
bind -n M-\= next-window
bind -n M-PageDown next-window
bind -n M-n new-window -c "~/"
bind N new-window -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
bind w kill-window
# pane
set -g pane-base-index 1
bind -n M-P confirm-before -p "Kill pane '#P'? (y/N)" kill-pane
bind M-p command-prompt -p "Rename pane:" -I '#P' 'rename-pane %1'
bind Tab select-pane -t:.+
bind BTab select-pane -t:.-
bind -n M-Left select-pane -L
bind -n M-Down select-pane -D
bind -n M-Up select-pane -U
bind -n M-Right select-pane -R
bind -r h resize-pane -L "8"
bind -r j resize-pane -D "8"
bind -r k resize-pane -U "8"
bind -r l resize-pane -R "8"
bind z resize-pane -Z
bind -n M-\[ swap-pane -D
bind -n M-\] swap-pane -U
# theme
source-file ~/.config/tmux/tmux.theme
# oci
%if '#{==:#{OCI},1}'
unbind C-z
%endif
set -g status on
set -g status-interval "1"
set -g status-style "fg=#31748f,bg=#191724"
set -g status-left-length "200"
set -g status-left " "
set -g status-right-length "200"
set -g status-right "\
#[fg=#6e6a86,bg=#26233a]\
 \
#[bg=#1f1d2e]\
#{user} \
#[fg=#6e6a86,bg=#26233a]\
 \
#[bg=#1f1d2e]\
#{session_name} \
#[fg=#6e6a86,bg=#26233a]\
 \
#[bg=#1f1d2e]\
#{window_index}:#{session_windows} \
#[fg=#6e6a86,bg=#26233a]\
 \
#[bg=#1f1d2e]\
#{pane_index}:#{window_panes} \
#[default] "
set -g window-status-separator " "
set -g window-status-format "\
#[fg=#6e6a86,bg=#26233a]\
#{window_index} \
#[bg=#1f1d2e]\
#{window_name}\
#[fg=#9ccfd8]\
#{?window_flags,* ,}\
#[default]"
set -g window-status-current-format "\
#[fg=#191724,bg=#eb6f92,bold]\
#{?client_prefix,#[bg=#f6c177],}\
 #{window_index} \
#[fg=#eb6f92,bg=#191724]\
#{?client_prefix,#[fg=#f6c177],}\
#{window_name}\
#[default]"
set -g pane-border-status top
set -g pane-border-style "fg=#6e6a86,bg=default,none"
set -g pane-border-format " #{pane_index} "
set -g pane-active-border-style "fg=#eb6f92,bg=default,none"
set -g message-style "fg=#191724,bg=#f6c177,none"
set -g message-command-style "fg=#f6c177,bg=#191724,none"
# --- theme -------------------------------------------------------------------
# https://rosepinetheme.com/
# https://github.com/tmux/tmux/blob/master/options-table.c
# -----------------------------------------------------------------------------
# thm_base="#191724"
# thm_surface="#1f1d2e"
# thm_overlay="#26233a"
# thm_muted="#6e6a86"
# thm_subtle="#908caa"
# thm_text="#e0def4"
# thm_love="#eb6f92"
# thm_gold="#f6c177"
# thm_rose="#ebbcba"
# thm_pine="#31748f"
# thm_foam="#9ccfd8"
# thm_iris="#c4a7e7"
# thm_hl_low="#21202e"
# thm_hl_med="#403d52"
# thm_hl_high="#524f67"
# -----------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment