Skip to content

fix(buffers): toggle between recently used buffers - #276

Merged
fcoury merged 1 commit into
mainfrom
fcoury/recent-buffer-toggle
Aug 18, 2026
Merged

fcoury merged 1 commit into
mainfrom
fcoury/recent-buffer-toggle

Conversation

@fcoury-oai

Copy link
Copy Markdown
Collaborator

Space Space currently shares the NextBuffer action with Space n, so it cycles through every open buffer instead of returning to the last one used.

This adds an AlternateBuffer action and maps Space Space to it. Buffer history uses stable IDs, follows explicit navigation and window focus, and skips closed buffers. Temporary selections made for LSP edits do not change that history. Space n and Space p keep their existing sequential behavior. The command palette and getting-started guide describe the new shortcut.

How to Test

  1. Open three buffers, then visit them in order with Space n. From the third buffer, press Space Space repeatedly. It should alternate between the second and third buffers without returning to the first.
  2. Use Space p to visit another buffer, then press Space Space. It should return to the buffer you just left. Verify that Space n and Space p still traverse the buffer list in order.
  3. Close one of the recently visited buffers with :bd, then use Space Space. It should switch only to a remaining, previously visited buffer. With no other visited buffer, the shortcut should do nothing.
  4. Run cargo test --lib buffer. The regression tests cover the actual key chord, window focus, buffer removal, temporary LSP selections, and command-palette shortcuts.

Local validation at 2fcfc72: all 138 buffer-related tests passed; the full library rerun passed with 1,943 tests passed and one ignored; formatting and cargo clippy --all-targets --all-features -- -D warnings passed. One format-on-save test failed on a missing temporary output file during the first full run, then passed both in isolation and in the full rerun.

@fcoury
fcoury merged commit 9b7b604 into main Aug 18, 2026
11 checks passed
@fcoury
fcoury deleted the fcoury/recent-buffer-toggle branch August 18, 2026 03:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants