diff --git a/README.md b/README.md index dcb28ec..c757d61 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,8 @@ Newly created pane always has the same path as the original pane. - `prefix + <` - moves current window one position to the left - `prefix + >` - moves current window one position to the right +These mappings are `repeatable`. + ### Installation with [Tmux Plugin Manager](https://github.com/tmux-plugins/tpm) (recommended) Add plugin to the list of TPM plugins in `.tmux.conf`: diff --git a/pain_control.tmux b/pain_control.tmux index 329f41b..8781bae 100755 --- a/pain_control.tmux +++ b/pain_control.tmux @@ -27,8 +27,15 @@ pane_navigation_bindings() { } window_move_bindings() { - tmux bind-key -r "<" swap-window -t -1 - tmux bind-key -r ">" swap-window -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 (( $(echo "$(tmux -V | grep -Eo "[0-9]+\.[0-9]+") >= 3.0" | bc -l) )); 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() {