Add Alt+Shift+Arrow keybindings for swapping tmux windows

This commit is contained in:
David Heinemeier Hansson
2026-03-01 16:33:04 +01:00
parent 80224cb954
commit 149bf44763
2 changed files with 15 additions and 0 deletions
+2
View File
@@ -43,6 +43,8 @@ bind -n M-9 select-window -t 9
bind -n M-Left select-window -t -1 bind -n M-Left select-window -t -1
bind -n M-Right 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
# Session controls # Session controls
bind R command-prompt -I "#S" "rename-session -- '%%'" bind R command-prompt -I "#S" "rename-session -- '%%'"
+13
View File
@@ -0,0 +1,13 @@
echo "Add Alt+Shift+Arrow keybindings for swapping tmux windows"
TMUX_CONF=~/.config/tmux/tmux.conf
if [[ -f $TMUX_CONF ]]; then
if ! grep -q "bind -n M-S-Left swap-window" "$TMUX_CONF"; then
sed -i '/bind -n M-Right select-window -t +1/a\
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' "$TMUX_CONF"
fi
omarchy-restart-tmux
fi