Skip to content
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

[Feature] Harpoon like bookmarks #5167

Open
otavioschwanck opened this issue Dec 15, 2022 · 3 comments · May be fixed by #10905
Open

[Feature] Harpoon like bookmarks #5167

otavioschwanck opened this issue Dec 15, 2022 · 3 comments · May be fixed by #10905
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements

Comments

@otavioschwanck
Copy link

Harpoon: https://github.com/ThePrimeagen/harpoon

Harpoon is like bookmarks, but better.

Something to save files with option to be per cwd (project).

  • Navigate on files with telescope.
  • Navigate between files with SPC 1, SPC 2, SPC 3 or something like that.
  • Save, delete, clear files on helix bookmarks.

I miss this so much from vim, would be awesome to have natively

@otavioschwanck otavioschwanck added the C-enhancement Category: Improvements label Dec 15, 2022
@kirawi kirawi added the A-helix-term Area: Helix term improvements label Dec 15, 2022
@kellpossible
Copy link

additionally it supports a bookmark set per git branch which I get a lot of use out of

@cdecompilador
Copy link

without plugin system is impossible, but would be a simple task to bundle it to the code, when i have time i will try and post the git patch here just i case someone else wants to try

@hakan-demirli
Copy link

hakan-demirli commented Apr 23, 2024

Here is a simple harpoon implementation for tmux users.

harpoon.mp4

Usage
Keymap is adjustable in helix:

  • Ctrl+h:
    • Add current file:cursor_position to harpoon list
  • Ctrl+jkl:
    • Switch to 1st, 2nd, or 3rd entry in the harpoon list.
  • Ctrl+n:
    • Edit harpoon list on floating helix instance

Installation
Add these files to your path:
helix_harpoon_add
helix_harpoon_switch
helix_harpoon_edit
helix_harpoon_update
helix_harpoon_parse
You may need to adjust parsing regex if you have a customized status line.
I use this regex.

Add your harpoon bindings

[keys.normal]
"C-h" = ":pipe-to helix_harpoon_add"
"C-n" = ":pipe-to helix_harpoon_edit"
"C-j" = [":pipe-to helix_harpoon_update",":pipe-to helix_harpoon_switch 1"]
"C-k" = [":pipe-to helix_harpoon_update",":pipe-to helix_harpoon_switch 2"]
"C-l" = [":pipe-to helix_harpoon_update",":pipe-to helix_harpoon_switch 3"]
... # Expand as you need (4,5,6...).

Note: If you want to return where you were, using harpoon shortcuts; anything that changes your current buffer has to call helix_harpoon_update first. So, you must prepend it to all of these commands:

[keys.normal.g]
"n" = [":pipe-to helix_harpoon_update","goto_next_buffer"]
"p" = [":pipe-to helix_harpoon_update","goto_previous_buffer"]
"d" = [":pipe-to helix_harpoon_update","goto_definition"]
"y" = [":pipe-to helix_harpoon_update","goto_type_definition"]
"r" = [":pipe-to helix_harpoon_update","goto_reference"]
# There are more. Expand as you need.

Also, harpoon config is saved to $HOME/.cache/helix_harpoon/<pwd_hash>.txt

@savente93 savente93 linked a pull request Jun 8, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants