helix icon indicating copy to clipboard operation
helix copied to clipboard

[Draft] Add simple goto buffer command like Harpoon2 for Helix

Open nikola2501 opened this issue 7 months ago • 2 comments

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_jumplist field to the Editor struct 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 the jumplist.
    • add-buffer-to-jumplist: Adds the current document buffer to the jumplist.
    • remove-buffer-from-jumplist: Removes the current document buffer from the jumplist.

UI changes

image
  • Update the buffer_picker function to display the index of each buffer in the jumplist as part of the flags column. This helps me identify and navigate to buffers in the jumplist 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 buffer jumplist.

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"
image

nikola2501 avatar Apr 30 '25 11:04 nikola2501

https://github.com/helix-editor/helix/pull/10905 seems to try to implement the same features

kirawi avatar Apr 30 '25 18:04 kirawi

#10905 seems to try to implement the same features

Yeah, it seems similar, especially in terms of inspiration, a bit less so in implementation 👍

nikola2501 avatar May 01 '25 09:05 nikola2501