##### keybinds (+ global ON/OFF like Zellij’s Ctrl-G) ##### # Global switch: when OFF, your custom binds are paused and keys pass to apps. set -g @ui_binds on # Toggle (Ctrl+g) — refresh status immediately so colors/badge update unbind -n C-g bind -n C-g if-shell -F '#{==:#{@ui_binds},on}' \ "set -g @ui_binds off; refresh-client -S; display-message 'User binds: OFF (Ctrl+g to re-enable)'" \ "set -g @ui_binds on; refresh-client -S; display-message 'User binds: ON'" # Helper pattern for guarded binds: # unbind -n # bind -n if-shell -F '#{==:#{@ui_binds},on}' "" "send-keys " ##### Tabs / windows ##### # New tab unbind -n C-t bind -n C-t if-shell -F '#{==:#{@ui_binds},on}' \ "new-window" \ "send-keys C-t" # Close tab (confirm) unbind -n C-w bind -n C-w if-shell -F '#{==:#{@ui_binds},on}' \ "confirm-before -p 'Kill window #W? (y/n)' kill-window" \ "send-keys C-w" # Previous / Next tab unbind -n C-M-Left bind -n C-M-Left if-shell -F '#{==:#{@ui_binds},on}' \ "previous-window" \ "send-keys C-M-Left" # unbind -n M-j # bind -n M-j if-shell -F '#{==:#{@ui_binds},on}' \ # "previous-window" \ # "send-keys M-j" unbind -n C-M-Right bind -n C-M-Right if-shell -F '#{==:#{@ui_binds},on}' \ "next-window" \ "send-keys C-M-Right" # unbind -n M-l # bind -n M-l if-shell -F '#{==:#{@ui_binds},on}' \ # "next-window" \ # "send-keys M-l" ##### Panes / splits ##### # Split left/right (vertical divider) unbind -n M-\\ bind -n M-\\ if-shell -F '#{==:#{@ui_binds},on}' \ "split-window -h" \ "send-keys M-\\" # Split top/bottom (horizontal divider) unbind -n "M-|" bind -n "M-|" if-shell -F '#{==:#{@ui_binds},on}' \ "split-window -v" \ "send-keys M-\|" # Kill pane with Alt+Shift+W (guarded; passes through when binds OFF) unbind -n M-W bind -n M-W if-shell -F '#{==:#{@ui_binds},on}' \ "confirm-before -p 'Kill pane #P? (y/n)' kill-pane" \ "send-keys M-W" # Backup: Ctrl+Alt+w also kills the pane (guarded) unbind -n C-M-w bind -n C-M-w if-shell -F '#{==:#{@ui_binds},on}' \ "confirm-before -p 'Kill pane #P? (y/n)' kill-pane" \ "send-keys C-M-w" ##### Pane focus ##### unbind -n C-S-Left bind -n C-S-Left if-shell -F '#{==:#{@ui_binds},on}' \ "select-pane -L" \ "send-keys C-S-Left" unbind -n M-J bind -n M-J if-shell -F '#{==:#{@ui_binds},on}' \ "select-pane -L" \ "send-keys M-J" unbind -n C-S-Right bind -n C-S-Right if-shell -F '#{==:#{@ui_binds},on}' \ "select-pane -R" \ "send-keys C-S-Right" unbind -n M-L bind -n M-L if-shell -F '#{==:#{@ui_binds},on}' \ "select-pane -R" \ "send-keys M-L" unbind -n C-S-Up bind -n C-S-Up if-shell -F '#{==:#{@ui_binds},on}' \ "select-pane -U" \ "send-keys C-S-Up" unbind -n M-I bind -n M-I if-shell -F '#{==:#{@ui_binds},on}' \ "select-pane -U" \ "send-keys M-I" unbind -n C-S-Down bind -n C-S-Down if-shell -F '#{==:#{@ui_binds},on}' \ "select-pane -D" \ "send-keys C-S-Down" unbind -n M-K bind -n M-K if-shell -F '#{==:#{@ui_binds},on}' \ "select-pane -D" \ "send-keys M-K" ##### Pane resize ##### unbind -n C-M-S-Left bind -n C-M-S-Left if-shell -F '#{==:#{@ui_binds},on}' \ "resize-pane -L 5" \ "send-keys C-M-S-Left" unbind -n C-M-S-Right bind -n C-M-S-Right if-shell -F '#{==:#{@ui_binds},on}' \ "resize-pane -R 5" \ "send-keys C-M-S-Right" unbind -n C-M-S-Up bind -n C-M-S-Up if-shell -F '#{==:#{@ui_binds},on}' \ "resize-pane -U 2" \ "send-keys C-M-S-Up" unbind -n C-M-S-Down bind -n C-M-S-Down if-shell -F '#{==:#{@ui_binds},on}' \ "resize-pane -D 2" \ "send-keys C-M-S-Down"