Files
tmux/tmux.conf
T
2026-06-23 14:20:40 +02:00

78 lines
3.0 KiB
Bash

set -g mouse on
set -g base-index 1
set -g pane-base-index 1
set-option -g status-position top
set -g allow-passthrough on
set -g extended-keys on
set -g extended-keys-format csi-u
# Copy mode: don't copy instantly on mouse-up. Releasing the drag keeps the
# selection and stays in copy mode; press y or Enter to actually copy, q/Esc to cancel.
set -g mode-keys vi
bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X stop-selection
bind -T copy-mode MouseDragEnd1Pane send-keys -X stop-selection
bind -T copy-mode-vi y send-keys -X copy-selection-and-cancel
bind -T copy-mode-vi Enter send-keys -X copy-selection-and-cancel
bind -T copy-mode y send-keys -X copy-selection-and-cancel
bind -T copy-mode Enter send-keys -X copy-selection-and-cancel
# Subtler selection highlight (instead of the bright orange default)
set -g mode-style "bg=#504945,fg=default"
# Right side: date and time
set -g status-right "%Y-%m-%d | %H:%M"
set -g status-right-length 50
# Window list style
set -g status-style "bg=#3c3836"
set -g window-status-style "bg=#3c3836"
set -g window-status-current-style "bg=#3c3836,bold"
# New window / window (tab) switching
bind -n M-t new-window -c "#{pane_current_path}"
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
# Pane navigation
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
# Splits
bind -n M-= split-window -v -c "#{pane_current_path}" # horizontal split (top/bottom)
bind -n 'M-\' split-window -h -c "#{pane_current_path}" # vertical split (side-by-side)
# Close current pane
bind -n M-w kill-pane
# Resize mode (kitty-style): M-r enters, = grows / - shrinks the active pane, q/Esc/Enter exit.
# Orientation heuristic: a pane spanning the full window width is part of a top/bottom
# split -> resize height; otherwise it has a side neighbour -> resize width.
# Edge-aware: -L/-R/-U/-D are absolute directions, so to consistently grow/shrink the
# ACTIVE pane we push toward whichever neighbour exists (depends on which edge it's on).
# Re-enter the table after each resize so the mode stays active.
bind -n M-r switch-client -T resize_mode
bind -T resize_mode = {
if-shell -F '#{&&:#{pane_at_left},#{pane_at_right}}' \
{ if-shell -F '#{pane_at_bottom}' 'resize-pane -U 3' 'resize-pane -D 3' } \
{ if-shell -F '#{pane_at_right}' 'resize-pane -L 3' 'resize-pane -R 3' }
switch-client -T resize_mode
}
bind -T resize_mode - {
if-shell -F '#{&&:#{pane_at_left},#{pane_at_right}}' \
{ if-shell -F '#{pane_at_bottom}' 'resize-pane -D 3' 'resize-pane -U 3' } \
{ if-shell -F '#{pane_at_right}' 'resize-pane -R 3' 'resize-pane -L 3' }
switch-client -T resize_mode
}
bind -T resize_mode q switch-client -T root
bind -T resize_mode Escape switch-client -T root
bind -T resize_mode Enter switch-client -T root