diff --git a/tmux.conf b/tmux.conf index 8ad32a5..3fd109e 100644 --- a/tmux.conf +++ b/tmux.conf @@ -4,14 +4,59 @@ set -g pane-base-index 1 set-option -g status-position top set -g allow-passthrough on -# Right side: disable (remove everything) -set -g status-right "" +# 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" -bind c new-window -c "#{pane_current_path}" -bind % split-window -h -c "#{pane_current_path}" -bind '"' split-window -v -c "#{pane_current_path}" +# 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