[Draft] Add simple goto buffer command like Harpoon2 for Helix
Add a goto buffer feature to Helix, inspired by Harpoon2 for Neovim. It lets you quickly jump between open buffers with a typed 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 the jumplist, and updates to the user interface to display jumplist indices.
Buffer Jumplist Functionality
- Add a
buffer_jumplistfield to theEditorstruct to store a manually curated list of document IDs for navigation.
Commands for Jumplist Interaction
- Introduce three new commands:
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
- Update the
buffer_pickerfunction to display the index of each buffer in thejumplistas part of the flags column. This helps me identify and navigate to buffers in thejumplistmore 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:
q.a=":ab"
q.d=":rb"
q.0=":j 0"
q.1=":j 1"
q.2=":j 2"
q.3=":j 3"
q.4=":j 4"
https://github.com/helix-editor/helix/pull/10905 seems to try to implement the same features
#10905 seems to try to implement the same features
Yeah, it seems similar, especially in terms of inspiration, a bit less so in implementation 👍