/harpoon.el

Harpoon for emacs

Primary LanguageEmacs LispGNU General Public License v3.0GPL-3.0

About

Harpoon package for emacs, based on the plugin from ThePrimeagen.

This package offers quick bookmarks separated by project and branch. You can quick navigate between your working files and forget about that files opened that you will not use anymore.

Harpoon is more a way to manage and quick navigate between the main files that you are working on than a bookmark system.

harpoon.gif

Installation

Manual

Load harpoon.el in your personal configuration.

MELPA

M-x package-install harpoon

Doom Emacs

Add to package.el:

(package! harpoon)

Features

  • Add, order and delete harpoons in your code.
  • Harpoon is separated by project and branch
  • Quick switch between harpoons
  • Jump between last and previous entries

Configuring

Example of how to set the shortcuts:

;; On vanilla (You can use another prefix instead C-c h)

;; You can use this hydra menu that have all the commands
(global-set-key (kbd "C-c a") 'harpoon-quick-menu-hydra)
(global-set-key (kbd "C-c h <return>") 'harpoon-add-file)

;; And the vanilla commands
(global-set-key (kbd "C-c h f") 'harpoon-toggle-file)
(global-set-key (kbd "C-c h h") 'harpoon-toggle-quick-menu)
(global-set-key (kbd "C-c h c") 'harpoon-clear)
(global-set-key (kbd "C-c h 1") 'harpoon-go-to-1)
(global-set-key (kbd "C-c h 2") 'harpoon-go-to-2)
(global-set-key (kbd "C-c h 3") 'harpoon-go-to-3)
(global-set-key (kbd "C-c h 4") 'harpoon-go-to-4)
(global-set-key (kbd "C-c h 5") 'harpoon-go-to-5)
(global-set-key (kbd "C-c h 6") 'harpoon-go-to-6)
(global-set-key (kbd "C-c h 7") 'harpoon-go-to-7)
(global-set-key (kbd "C-c h 8") 'harpoon-go-to-8)
(global-set-key (kbd "C-c h 9") 'harpoon-go-to-9)

;; On doom emacs

;; You can use this hydra menu that have all the commands
(map! :n "C-SPC" 'harpoon-quick-menu-hydra)
(map! :n "C-s" 'harpoon-add-file)

;; And the vanilla commands
(map! :leader "j c" 'harpoon-clear)
(map! :leader "j f" 'harpoon-toggle-file)
(map! :leader "1" 'harpoon-go-to-1)
(map! :leader "2" 'harpoon-go-to-2)
(map! :leader "3" 'harpoon-go-to-3)
(map! :leader "4" 'harpoon-go-to-4)
(map! :leader "5" 'harpoon-go-to-5)
(map! :leader "6" 'harpoon-go-to-6)
(map! :leader "7" 'harpoon-go-to-7)
(map! :leader "8" 'harpoon-go-to-8)
(map! :leader "9" 'harpoon-go-to-9)

Customizing

You can customize by setting this variable:

VariableDescriptionDefault
harpoon-separate-by-branchIf nil, ignores the brancht
harpoon-project-packagePackage used to harpoon to get project stuff. Available: projectile, project‘projectile
harpoon-without-project-functionFunction used to return a name for harpoon cache file when not visiting a project.‘harpoon–package-name

Extra tips for harpoon-without-project-function

If you want that harpoon behaves uses the current file directory, change it to ‘harpoon–current-file-directory

If you use doom , you can set this variable to ‘+workspace-current-name and use the workspace name instead the harpoon global.

You can also create your own function to determine the harpoon cache file and add to this variable.

My other works:

Rails i18n:

https://github.com/otavioschwanck/rails-i18n.el

Rails routes:

https://github.com/otavioschwanck/rails-routes.el

My Personal Config (for rails)

(Very complete, has videos + handbooks of how to use) https://github.com/otavioschwanck/doom-emacs-on-rails/

Do you like my work? Please, buy me a coffee

https://www.buymeacoffee.com/otavioschwanck