Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve window move bindings #30

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`:
Expand Down
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 -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() {
Expand Down