[Draft] Add simple goto buffer command like Harpoon2 for Helix #13448
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add a
goto
buffer feature to Helix, inspired by Harpoon2 for Neovim. It lets you quickly jump between open buffers with atyped
command. The key difference from earlier approaches is that it doesn't depend on the current buffer list, but maintains its own jump list.The PR is still rough around the edges. I'd appreciate your early feedback. No tests or docs yet - I’ll add those if y’all like the idea. This patch already works for my needs, but I’m down to polish it if the community is into it. My goal was a minimal MVP patch with maximum reuse.
The changes include adding the buffer
jumplist
functionality, commands for interacting with thejumplist
, and updates to the user interface to displayjumplist
indices.Buffer Jumplist Functionality
buffer_jumplist
field to theEditor
struct to store a manually curated list of document IDs for navigation.Commands for Jumplist Interaction
jump-to-buffer
: Switches to a document buffer using its index in thejumplist
.add-buffer-to-jumplist
: Adds the current document buffer to thejumplist
.remove-buffer-from-jumplist
: Removes the current document buffer from thejumplist
.UI changes
buffer_picker
function to display the index of each buffer in thejumplist
as part of the flags column. This helps me identify and navigate to buffers in thejumplist
more easily. I know this isn't an ideal user experience, but it's good enough for a draft PR and initial feedback. I'm planning to add a new column or even an entirely new picker for the bufferjumplist
.Example usage
Feel free to configure the keybindings however it suits you: