Skip to content

Conversation

@esmuellert
Copy link
Owner

Summary

Adds a new keymap and fixes a keymap leak issue when switching between tabs.

Changes

New Feature: open_in_prev_tab keymap (gf)

  • Opens the current diff buffer in the previous tab (or creates a new tab before current if none exists)
  • Only works on real file buffers (not virtual/git revision buffers)
  • Preserves cursor position when switching

Bug Fix: Keymap leak on tab switch

  • Previously, keymaps set on diff buffers would persist when switching to other tabs, causing conflicts
  • Now clears keymaps on TabLeave and reapplies them on TabEnter
  • Uses a reapply_keymaps callback pattern to avoid stale closures referencing old buffer IDs
  • Refactored cleanup logic to use centralized clear_tab_keymaps accessor

Testing

  • Verified keymaps are cleared when leaving diff tab
  • Verified keymaps are restored when returning to diff tab
  • Tested gf keymap opens buffer in previous tab correctly

Closes #67

- Add new 'gf' keymap to open current buffer in previous tab (or create one)
- Fix keymap leak when switching tabs by clearing on TabLeave and reapplying on TabEnter
- Use reapply_keymaps callback pattern to avoid stale closures
- Refactor cleanup to use clear_tab_keymaps accessor

Closes #67
@esmuellert esmuellert enabled auto-merge January 27, 2026 04:33
@esmuellert esmuellert merged commit 32ccb9b into main Jan 27, 2026
13 checks passed
@chapeupreto
Copy link

Thank you very much!! 👏

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.

Keymap to go to file

3 participants