Skip to content

Commit

Permalink
Handle versions of tmux < 3.0 correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
kaykayehnn committed Jan 8, 2020
1 parent 0ef5b53 commit e36770b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pain_control.tmux
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,15 @@ pane_navigation_bindings() {
}

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

pane_resizing_bindings() {
Expand Down

0 comments on commit e36770b

Please sign in to comment.