Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

nikola2501
Copy link

@nikola2501 nikola2501 commented Apr 30, 2025

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 nikola2501 marked this pull request as draft April 30, 2025 11:54
@kirawi
Copy link
Member

kirawi commented Apr 30, 2025

#10905 seems to try to implement the same features

@nikola2501
Copy link
Author

#10905 seems to try to implement the same features

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

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