tmux configuration redesign

This commit is contained in:
2026-07-18 13:56:41 +05:30
parent bd0fca3af6
commit de44196750
3 changed files with 154 additions and 79 deletions
+67
View File
@@ -0,0 +1,67 @@
# ==============================================================================
# TMUX KEYBINDINGS
# ==============================================================================
# Prefix key override: change from C-b to C-a
set -gu prefix2
unbind C-a
unbind C-b
set -g prefix C-a
bind C-a send-prefix
# Fast window switching with Alt + Number
bind-key -n M-1 select-window -t 1
bind-key -n M-2 select-window -t 2
bind-key -n M-3 select-window -t 3
bind-key -n M-4 select-window -t 4
bind-key -n M-5 select-window -t 5
bind-key -n M-6 select-window -t 6
bind-key -n M-7 select-window -t 7
bind-key -n M-8 select-window -t 8
bind-key -n M-9 select-window -t 9
# Toggle centered popup scratch terminal with Alt + p
bind-key -n -N 'Toggle popup window' M-p if-shell -F '#{==:#{session_name},popup}' {
detach-client
} {
display-popup -d "#{pane_current_path}" -xC -yC -w 70% -h 65% -E 'tmux attach-session -t popup || tmux new-session -s popup'
}
# Run tmux-sessionizer with Alt + f
bind-key -n M-f send-keys "tmux-sessionizer\n"
# Sleek centered FZF popup search overlays (requires fzf)
# Alt-s: Fuzzy search and switch sessions in popup
bind-key -n M-s display-popup -w 65% -h 50% -E "tmux list-sessions | fzf --reverse --header='Jump to Session' | cut -d: -f1 | xargs tmux switch-client -t"
# Alt-w: Fuzzy search and switch windows in popup
bind-key -n M-w display-popup -w 75% -h 60% -E "tmux list-windows -a -F '#{session_name}:#{window_index} - #{window_name}' | fzf --reverse --header='Jump to Window' | cut -d' ' -f1 | xargs tmux select-window -t"
# ==============================================================================
# COPY MODE (VI MODE) & INSTANT STATUS REDRAW
# ==============================================================================
# Force immediate status redraw when entering copy mode
bind-key [ copy-mode \; refresh-client -S
# vi-copy navigation and selection bindings with instant status bar update
bind-key -T copy-mode-vi v send-keys -X begin-selection \; refresh-client -S
bind-key -T copy-mode-vi V send-keys -X select-line \; refresh-client -S
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle \; refresh-client -S
bind-key -T copy-mode-vi q send-keys -X cancel \; refresh-client -S
bind-key -T copy-mode-vi Escape send-keys -X cancel \; refresh-client -S
bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel \; refresh-client -S
# Mouse Drag Selection: copy to clipboard and redraw instantly without leaving copy-mode
unbind -T copy-mode-vi MouseDragEnd1Pane
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-selection-and-cancel \; refresh-client -S
# ==============================================================================
# PANE NAVIGATION & RESIZING OVERRIDES (NO PREFIX)
# ==============================================================================
# Resize panes using Shift + Arrow keys
bind -n S-Left resize-pane -L 2
bind -n S-Right resize-pane -R 2
bind -n S-Up resize-pane -U 2
bind -n S-Down resize-pane -D 2