Skip to content

Instantly share code, notes, and snippets.

@cruzluna
Last active March 7, 2026 17:33
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
# quick action
bind x kill-pane
bind X kill-window
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
# ui
set-option -g status-position top
set -g status-style bg=colour236,fg=colour255
set -g message-style bg=colour201,fg=colour255
set -g status-left-length 120
set -g status-right-length 60
set -g status-left '#[fg=colour255,bg=colour201,bold] #S #[fg=colour255,bg=colour236,nobold] #{pane_current_path} '
set -g status-right '#[fg=colour250,bg=colour236]%Y-%m-%d %H:%M '
setw -g window-status-format ' #I:#W '
setw -g window-status-current-format '#[fg=colour255,bg=colour201,bold] #I:#W '
setw -g window-status-current-style fg=colour255,bg=colour201
setw -g window-status-style fg=colour250,bg=colour236
# tpm plugin
set -g @plugin 'tmux-plugins/tpm'
# list of tmux plugins
set -g @plugin 'christoomey/vim-tmux-navigator'
# set -g @plugin 'jimeh/tmux-themepack'
set -g @plugin 'tmux-plugins/tmux-resurrect' # persist tmux sessions after computer restart
set -g @plugin 'tmux-plugins/tmux-continuum' # automatically saves sessions for you every 15 minutes
set -g @plugin 'cruzluna/jkl-2'
set -g @jkl_force_bind_keys 'on'
# set -g @themepack 'powerline/default/orange'
set -g @resurrect-capture-pane-contents 'on'
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