better tmux support

This commit is contained in:
2026-03-11 19:05:12 +00:00
parent 7b5f5cf0c7
commit f67ce8545c
6 changed files with 170 additions and 15 deletions
+52 -12
View File
@@ -92,11 +92,14 @@ bind -n M-Down select-pane -D
bind -n M-Up select-pane -U
bind -n M-Right select-pane -R
# Resize panes with prefix + hjkl
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# Resize panes - Ctrl+R then arrows (no prefix needed)
bind -n C-r switch-client -T resize-pane \; display-message -d 5000 "RESIZE MODE: arrows to resize, ESC/Enter to exit"
bind -T resize-pane Left resize-pane -L 5 \; switch-client -T resize-pane
bind -T resize-pane Right resize-pane -R 5 \; switch-client -T resize-pane
bind -T resize-pane Up resize-pane -U 5 \; switch-client -T resize-pane
bind -T resize-pane Down resize-pane -D 5 \; switch-client -T resize-pane
bind -T resize-pane Escape switch-client -T root
bind -T resize-pane Enter switch-client -T root
# -----------------------------------------
# Moving Panes (Zellij-like)
@@ -112,6 +115,15 @@ bind j command-prompt -p "join pane from window #:" "join-pane -s '%%'"
bind > swap-pane -D
bind < swap-pane -U
# Move panes around - Ctrl+E then arrows (no prefix needed, stays in mode)
bind -n C-e switch-client -T move-pane \; display-message -d 5000 "MOVE MODE: arrows to move pane, ESC/Enter to exit"
bind -T move-pane Left swap-pane -s '{left-of}' \; switch-client -T move-pane
bind -T move-pane Right swap-pane -s '{right-of}' \; switch-client -T move-pane
bind -T move-pane Up swap-pane -s '{up-of}' \; switch-client -T move-pane
bind -T move-pane Down swap-pane -s '{down-of}' \; switch-client -T move-pane
bind -T move-pane Escape switch-client -T root
bind -T move-pane Enter switch-client -T root
# Mark pane + swap with marked pane (advanced)
bind m select-pane -m # Mark current pane
bind M swap-pane # Swap with marked pane
@@ -133,10 +145,18 @@ bind BSpace previous-layout
# Quick layout shortcuts
bind Enter select-layout tiled
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
# Easy horizontal/vertical layouts
bind = select-layout even-horizontal
bind + select-layout even-vertical
# Toggle between horizontal and vertical
bind t run-shell "tmux list-windows -F '#{window_layout}' | head -1 | grep -q 'even-horizontal' && tmux select-layout even-vertical || tmux select-layout even-horizontal"
# Other layouts - Ctrl+L then h/v (no prefix)
bind -n C-l switch-client -T layout \; display-message -d 5000 "LAYOUT MODE: h=horizontal v=vertical ESC/Enter=back"
bind -T layout h select-layout main-horizontal \; switch-client -T root
bind -T layout v select-layout main-vertical \; switch-client -T root
# Note: Pane resize with H/J/K/L is defined in the resize section above
@@ -181,8 +201,8 @@ bind , command-prompt -I "#W" "rename-window '%%'"
# Update status bar every second
set -g status-interval 1
# Position at bottom
set -g status-position bottom
# Position at top (for dual status bar with tabs on top, cheatsheet on bottom)
# Note: status-position bottom puts tabs at bottom-1, cheatsheet at very bottom
# Status bar sizing
set -g status-left-length 40
@@ -192,12 +212,32 @@ set -g status-right-length 100
# The theme file sets: status-style, status-left, status-right,
# window-status-format, window-status-current-format, pane borders, etc.
# -----------------------------------------
# Single Status Bar at Bottom
# -----------------------------------------
set -g status 1
set -g status-position bottom
set -g status-interval 1
set -g status-left-length 40
set -g status-right-length 150
# Help toggle (Ctrl+H) - uses run-shell to toggle help display
bind -n C-h run-shell '
if [ "$(tmux show -gqv @help_visible)" = "1" ]; then
tmux set -g @help_visible 0
tmux source ~/.config/tmux/colors.conf
else
tmux set -g @help_visible 1
tmux set -g status-right "#[bg=#014b71,fg=#cbe6ff,bold] ALT=nav ^E=move ^R=resize ^L=layout |/-=split ^S=prefix #[default]"
fi
'
# -----------------------------------------
# Other Useful Bindings
# -----------------------------------------
# Prefix + r to reload config
bind r source-file ~/.tmux.conf \; display "Config reloaded!"
bind r source-file ~/.config/tmux/tmux.conf \; display "Config reloaded!"
# Prefix + x to kill current pane (with confirmation)
bind x confirm-before -p "kill-pane #P? (y/n)" kill-pane