Fix window move to insert instead of swap #2

Merged
forgejo_admin merged 1 commit from 1-tmux-window-insert-not-swap into main 2026-03-26 04:17:28 +00:00
Contributor

Summary

  • Override pain-control's < and > bindings after TPM init to fix window movement
  • Remove -d flag so focus follows the moved window, enabling -r repeat to bubble windows through the list one position at a time
  • Placed after line 95 (run '~/.tmux/plugins/tpm/tpm') so overrides aren't clobbered by the plugin

Changes

  • .tmux.conf: Added 2 bind-key overrides (lines 100-104) in the post-TPM settings block

Test Plan

  • tmux source-file ~/.tmux.conf — reload config
  • Create 4+ windows, go to last window, mash prefix + < — window bubbles left one position per press
  • Mash prefix + > — window bubbles right one position per press
  • Other windows maintain relative order after movement
  • Boundary behavior: leftmost/rightmost wraps (default tmux, not a regression)

Review Checklist

  • Passed automated review-fix loop
  • No secrets committed
  • No unnecessary file changes
  • Commit messages are descriptive
  • Closes #1
  • No plan — standalone board-driven work (board-dotfiles#358)
## Summary - Override pain-control's `<` and `>` bindings after TPM init to fix window movement - Remove `-d` flag so focus follows the moved window, enabling `-r` repeat to bubble windows through the list one position at a time - Placed after line 95 (`run '~/.tmux/plugins/tpm/tpm'`) so overrides aren't clobbered by the plugin ## Changes - `.tmux.conf`: Added 2 `bind-key` overrides (lines 100-104) in the post-TPM settings block ## Test Plan - [ ] `tmux source-file ~/.tmux.conf` — reload config - [ ] Create 4+ windows, go to last window, mash `prefix + <` — window bubbles left one position per press - [ ] Mash `prefix + >` — window bubbles right one position per press - [ ] Other windows maintain relative order after movement - [ ] Boundary behavior: leftmost/rightmost wraps (default tmux, not a regression) ## Review Checklist - [ ] Passed automated review-fix loop - [ ] No secrets committed - [ ] No unnecessary file changes - [ ] Commit messages are descriptive ## Related - Closes #1 - No plan — standalone board-driven work (board-dotfiles#358)
Override pain-control's < and > bindings after TPM init.
Remove -d flag so focus follows the moved window, enabling
repeat (-r) to bubble windows through the list one position
at a time.

Closes forgejo_admin/dotfiles#1

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author
Contributor

PR #2 Review

DOMAIN REVIEW

Domain: tmux configuration (dotfiles)

The change is a 6-line addition to .tmux.conf that overrides tmux-plugins/tmux-pain-control's < and > window-swap bindings. The fix is technically correct:

  • pain-control's problem: It binds swap-window with -d (detach/don't follow), which means after a swap the focus stays at the original index. Pressing < again swaps the new window at that index, effectively toggling two windows instead of bubbling.
  • The fix: Rebinds < and > without -d, so focus follows the moved window. Combined with -r (repeatable), this enables bubble-sort behavior -- mashing < walks a window leftward one position per press.
  • Placement after TPM init (line 95): Correct. Placing overrides before run '~/.tmux/plugins/tpm/tpm' would get clobbered when pain-control loads. The existing "post-TPM settings" block (line 97) is the right location.
  • No conflict with line 17 (bind-key -n MouseDrag1Status swap-window -dt=): Mouse drag uses root table (-n), targets cursor position (=), and intentionally uses -d. The keyboard bindings use prefix table and target relative positions (-1/+1). These are independent and both behaviors are desirable.

No issues found with the implementation.

BLOCKERS

None.

This is a dotfiles configuration change. The BLOCKER criteria (test coverage, input validation, secrets, DRY auth) are not applicable to tmux config. There is no user input to validate, no auth logic, and no secrets.

NITS

  1. Missing newline at end of file: The diff shows \ No newline at end of file on line 108. This pre-dates this PR (the last line is the catppuccin format string, not part of this change), but it would be good housekeeping to add a trailing newline in a follow-up. Not blocking.

  2. PR body template: Uses ## Review Checklist where the SOP template expects the checklist items to be part of ## Related. Minor structural deviation -- all required information (Summary, Changes, Test Plan, Related) is present and complete.

SOP COMPLIANCE

  • Branch named after issue (1-tmux-window-insert-not-swap references issue #1)
  • PR body has Summary, Changes, Test Plan, Related sections
  • Related references board item (board-dotfiles#358) and Closes #1
  • No plan -- standalone board-driven work (correctly noted)
  • No secrets committed
  • No unnecessary file changes (1 file, 6 lines, all scoped to the fix)
  • Commit message is descriptive (PR title matches the intent)

PROCESS OBSERVATIONS

  • Deployment frequency: Dotfiles changes deploy instantly via tmux source-file. Low ceremony, low risk.
  • Change failure risk: Minimal. A bad tmux bind-key is recoverable by editing the config and reloading. No production service impact.
  • Test plan: Manual verification is appropriate for this domain. The test plan is thorough -- it covers happy path (bubble left/right), multi-window ordering preservation, and boundary wrapping behavior.

VERDICT: APPROVED

## PR #2 Review ### DOMAIN REVIEW **Domain**: tmux configuration (dotfiles) The change is a 6-line addition to `.tmux.conf` that overrides `tmux-plugins/tmux-pain-control`'s `<` and `>` window-swap bindings. The fix is technically correct: - **pain-control's problem**: It binds `swap-window` with `-d` (detach/don't follow), which means after a swap the focus stays at the original index. Pressing `<` again swaps the *new* window at that index, effectively toggling two windows instead of bubbling. - **The fix**: Rebinds `<` and `>` without `-d`, so focus follows the moved window. Combined with `-r` (repeatable), this enables bubble-sort behavior -- mashing `<` walks a window leftward one position per press. - **Placement after TPM init (line 95)**: Correct. Placing overrides before `run '~/.tmux/plugins/tpm/tpm'` would get clobbered when pain-control loads. The existing "post-TPM settings" block (line 97) is the right location. - **No conflict with line 17** (`bind-key -n MouseDrag1Status swap-window -dt=`): Mouse drag uses root table (`-n`), targets cursor position (`=`), and intentionally uses `-d`. The keyboard bindings use prefix table and target relative positions (`-1`/`+1`). These are independent and both behaviors are desirable. No issues found with the implementation. ### BLOCKERS None. This is a dotfiles configuration change. The BLOCKER criteria (test coverage, input validation, secrets, DRY auth) are not applicable to tmux config. There is no user input to validate, no auth logic, and no secrets. ### NITS 1. **Missing newline at end of file**: The diff shows `\ No newline at end of file` on line 108. This pre-dates this PR (the last line is the catppuccin format string, not part of this change), but it would be good housekeeping to add a trailing newline in a follow-up. Not blocking. 2. **PR body template**: Uses `## Review Checklist` where the SOP template expects the checklist items to be part of `## Related`. Minor structural deviation -- all required information (Summary, Changes, Test Plan, Related) is present and complete. ### SOP COMPLIANCE - [x] Branch named after issue (`1-tmux-window-insert-not-swap` references issue #1) - [x] PR body has Summary, Changes, Test Plan, Related sections - [x] Related references board item (`board-dotfiles#358`) and `Closes #1` - [x] No plan -- standalone board-driven work (correctly noted) - [x] No secrets committed - [x] No unnecessary file changes (1 file, 6 lines, all scoped to the fix) - [x] Commit message is descriptive (PR title matches the intent) ### PROCESS OBSERVATIONS - **Deployment frequency**: Dotfiles changes deploy instantly via `tmux source-file`. Low ceremony, low risk. - **Change failure risk**: Minimal. A bad tmux bind-key is recoverable by editing the config and reloading. No production service impact. - **Test plan**: Manual verification is appropriate for this domain. The test plan is thorough -- it covers happy path (bubble left/right), multi-window ordering preservation, and boundary wrapping behavior. ### VERDICT: APPROVED
forgejo_admin deleted branch 1-tmux-window-insert-not-swap 2026-03-26 04:17:28 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ldraney/dotfiles!2
No description provided.