Skip to content

Commit e36770b

Browse files
committed
Handle versions of tmux < 3.0 correctly
1 parent 0ef5b53 commit e36770b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

pain_control.tmux

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,15 @@ pane_navigation_bindings() {
2727
}
2828

2929
window_move_bindings() {
30-
tmux bind-key -r "<" swap-window -d -t -1
31-
tmux bind-key -r ">" swap-window -d -t +1
30+
# V3.0 changed the way tmux handles focus in swap-window. -d is now required
31+
# to keep focus on the current window.
32+
if [ "$(tmux -V | cut -d' ' -f2)" ">" 3.0 ]; then
33+
tmux bind-key -r "<" swap-window -d -t -1
34+
tmux bind-key -r ">" swap-window -d -t +1
35+
else
36+
tmux bind-key -r "<" swap-window -t -1
37+
tmux bind-key -r ">" swap-window -t +1
38+
fi
3239
}
3340

3441
pane_resizing_bindings() {

0 commit comments

Comments
 (0)