Skip to content

Instantly share code, notes, and snippets.

@cruzluna
Created October 21, 2025 16:32
Show Gist options
  • Select an option

  • Save cruzluna/1e5314bac7d46c9bf1608b346da83472 to your computer and use it in GitHub Desktop.

Select an option

Save cruzluna/1e5314bac7d46c9bf1608b346da83472 to your computer and use it in GitHub Desktop.
Tmux config
set -g default-terminal "screen-256color"
set -g prefix C-a
unbind C-b
bind-key C-a send-prefix
unbind %
bind \\ split-window -h
unbind '"'
bind - split-window -v
unbind r
bind r source-file ~/.tmux.conf
bind -r j resize-pane -D 5
bind -r k resize-pane -U 5
bind -r l resize-pane -R 5
bind -r h resize-pane -L 5
bind -r m resize-pane -Z
set -g mouse on
set-window-option -g mode-keys vi
bind-key -T copy-mode-vi 'v' send -X begin-selection # start selecting text with "v"
bind-key -T copy-mode-vi 'y' send -X copy-selection # copy text with "y"
unbind -T copy-mode-vi MouseDragEnd1Pane # don't exit copy mode when dragging with mouse
# # manually adding keybindings
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
bind-key -T copy-mode-vi 'C-h' select-pane -L
bind-key -T copy-mode-vi 'C-j' select-pane -D
bind-key -T copy-mode-vi 'C-k' select-pane -U
bind-key -T copy-mode-vi 'C-l' select-pane -R
bind-key -T copy-mode-vi 'C-\' select-pane -l
# end of keybindings
# Increase scrollback
set-option -g history-limit 50000
# UI of Tmux
# Current directory
# set -g status-left "#{pane_current_path}"
setw -g window-status-format "#{pane_current_path}".
set-option -g status-position top
# Set the status bar background and foreground colors to pink
set-option -g status-bg '#FF69B4' # Hot Pink
set-option -g status-fg '#FFFFFF' # White text for contrast
# Left side of the status bar: full session name and current directory
set-option -g status-left '#{session_name} - #{pane_current_path}'
# Make sure the left side isn't truncated
set -g status-left-length 200
# Left side of the status bar: full session name and current directory (+spacing)
set -g status-left '#{session_name} - #{pane_current_path} '
# List of plugins
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
# Enable continuum-restore
set -g @continuum-restore 'on'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment