Use tmux to list keybindings (#6308)

* Use tmux to list keybindings

* Annotate tmux keybindings

* List unannotated bindings too and let the isolated server exit on its own

list-keys -aN falls back to the raw command when a binding has no note,
so user-added bindings in an existing tmux.conf still show up. Dropping
exit-empty off means the throwaway server exits when the client
disconnects instead of relying solely on the trap.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: David Heinemeier Hansson <david@hey.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Michael Placzek
2026-07-19 09:50:32 -07:00
committed by GitHub
co-authored by Claude Fable 5 David Heinemeier Hansson
parent 0f2f3f11cb
commit 3754c2c031
2 changed files with 58 additions and 234 deletions
+42 -42
View File
@@ -1,65 +1,65 @@
# Prefix
set -g prefix C-Space
set -g prefix2 C-b
bind C-Space send-prefix
bind -N "Send prefix" C-Space send-prefix
# Config and help
bind q source-file ~/.config/tmux/tmux.conf \; display "Configuration reloaded"
bind ? display-popup -E -w 80% -h 70% -T "Tmux keybindings" "omarchy-menu-tmux-keybindings --print | less -R"
bind -N "Reload configuration" q source-file ~/.config/tmux/tmux.conf \; display "Configuration reloaded"
bind -N "Show Tmux keybindings" ? display-popup -E -w 80% -h 70% -T "Tmux keybindings" "omarchy-menu-tmux-keybindings --print | less -R"
# Vi mode for copy
setw -g mode-keys vi
bind -T copy-mode-vi v send -X begin-selection
bind -T copy-mode-vi y send -X copy-selection-and-cancel
bind -N "Begin selection" -T copy-mode-vi v send -X begin-selection
bind -N "Copy selection" -T copy-mode-vi y send -X copy-selection-and-cancel
# Pane Controls
bind -n M-Enter split-window -v -c "#{pane_current_path}"
bind -n M-S-Enter split-window -h -c "#{pane_current_path}"
bind -n M-Escape kill-pane
bind -N "Split pane vertically" -n M-Enter split-window -v -c "#{pane_current_path}"
bind -N "Split pane horizontally" -n M-S-Enter split-window -h -c "#{pane_current_path}"
bind -N "Kill pane" -n M-Escape kill-pane
bind h split-window -v -c "#{pane_current_path}"
bind v split-window -h -c "#{pane_current_path}"
bind x kill-pane
bind -N "Split pane vertically" h split-window -v -c "#{pane_current_path}"
bind -N "Split pane horizontally" v split-window -h -c "#{pane_current_path}"
bind -N "Kill pane" x kill-pane
bind -n C-M-Left select-pane -L
bind -n C-M-Right select-pane -R
bind -n C-M-Up select-pane -U
bind -n C-M-Down select-pane -D
bind -N "Focus pane left" -n C-M-Left select-pane -L
bind -N "Focus pane right" -n C-M-Right select-pane -R
bind -N "Focus pane up" -n C-M-Up select-pane -U
bind -N "Focus pane down" -n C-M-Down select-pane -D
bind -n C-M-S-Left resize-pane -L 5
bind -n C-M-S-Down resize-pane -D 5
bind -n C-M-S-Up resize-pane -U 5
bind -n C-M-S-Right resize-pane -R 5
bind -N "Resize pane left" -n C-M-S-Left resize-pane -L 5
bind -N "Resize pane down" -n C-M-S-Down resize-pane -D 5
bind -N "Resize pane up" -n C-M-S-Up resize-pane -U 5
bind -N "Resize pane right" -n C-M-S-Right resize-pane -R 5
# Window navigation
bind r command-prompt -I "#W" "rename-window -- '%%'"
bind c new-window -c "#{pane_current_path}"
bind k kill-window
bind -N "Rename window" r command-prompt -I "#W" "rename-window -- '%%'"
bind -N "Create window" c new-window -c "#{pane_current_path}"
bind -N "Kill window" k kill-window
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
bind -N "Switch to window 1" -n M-1 select-window -t 1
bind -N "Switch to window 2" -n M-2 select-window -t 2
bind -N "Switch to window 3" -n M-3 select-window -t 3
bind -N "Switch to window 4" -n M-4 select-window -t 4
bind -N "Switch to window 5" -n M-5 select-window -t 5
bind -N "Switch to window 6" -n M-6 select-window -t 6
bind -N "Switch to window 7" -n M-7 select-window -t 7
bind -N "Switch to window 8" -n M-8 select-window -t 8
bind -N "Switch to window 9" -n M-9 select-window -t 9
bind -n M-Left select-window -t -1
bind -n M-Right select-window -t +1
bind -n M-S-Left swap-window -t -1 \; select-window -t -1
bind -n M-S-Right swap-window -t +1 \; select-window -t +1
bind -N "Previous window" -n M-Left select-window -t -1
bind -N "Next window" -n M-Right select-window -t +1
bind -N "Move window left" -n M-S-Left swap-window -t -1 \; select-window -t -1
bind -N "Move window right" -n M-S-Right swap-window -t +1 \; select-window -t +1
# Session controls
bind R command-prompt -I "#S" "rename-session -- '%%'"
bind C new-session -c "#{pane_current_path}"
bind K kill-session
bind P switch-client -p
bind N switch-client -n
bind -N "Rename session" R command-prompt -I "#S" "rename-session -- '%%'"
bind -N "Create session" C new-session -c "#{pane_current_path}"
bind -N "Kill session" K kill-session
bind -N "Previous session" P switch-client -p
bind -N "Next session" N switch-client -n
bind -n M-Up switch-client -p
bind -n M-Down switch-client -n
bind -N "Previous session" -n M-Up switch-client -p
bind -N "Next session" -n M-Down switch-client -n
# General
set -g default-terminal "tmux-256color"