ThePrimeagen /harpoon

★ 9,246⑂ 491👁 39⑃ 329● 373▤ 0
LuaMITCreated 2020-11-04
+1
日增长
9,246
stars
491
forks
39
watchers
329
prs
373
issues
0
releases

README

⇁  HARPOON 2
This is a deprecated and all future changes will be to the branch harpoon2.

Harpoon 2

STATUS: Merging into mainline April 20th or June 9th (nice)

-------------------------------
 Legacy Harpoon README

 Harpoon
 Getting you where you want with the fewest keystrokes.





!Harpoon
-- image provided by Bob Rust

 ⇁  WIP
This is not fully baked, though used by several people. If you experience any
issues, see some improvement you think would be amazing, or just have some
feedback for harpoon (or me), make an issue!


 ⇁ The Problems:
1. You're working on a codebase. medium, large, tiny, whatever. You find
yourself frequenting a small set of files and you are tired of using a fuzzy finder,
:bnext & :bprev are getting too repetitive, alternate file doesn't quite cut it, etc etc.
1. You want to execute some project specific commands or have any number of
persistent terminals that can be easily navigated to.


 ⇁  The Solutions:
1. The ability to specify, or on the fly, mark and create persisting key strokes
to go to the files you want.
1. Unlimited terminals and navigation.


 ⇁ Installation
 neovim 0.5.0+ required
 install using your favorite plugin manager (vim-plug in this example)
vim
Plug 'nvim-lua/plenary.nvim' " don't forget to add this one if you don't have it yet!
Plug 'ThePrimeagen/harpoon'


 ⇁ Harpooning
here we'll explain how to wield the power of the harpoon:


 Marks
you mark files you want to revisit later on
lua
:lua require("harpoon.mark").add_file()


 File Navigation
view all project marks with:
lua
:lua require("harpoon.ui").toggle_quick_menu()

you can go up and down the list, enter, delete or reorder. q and  exit and save the menu

you also can switch to any mark without bringing up the menu, use the below with the desired mark index
lua
:lua require("harpoon.ui").nav_file(3)                  -- navigates to file 3

you can also cycle the list in both directions
lua
:lua require("harpoon.ui").nav_next()                   -- navigates to next mark
:lua require("harpoon.ui").nav_prev()                   -- navigates to previous mark

from the quickmenu, open a file in:
a vertical split with control+v,
a horizontal split with control+x,
a new tab with control+t

 Terminal Navigation
this works like file navigation except that if there is no terminal at the specified index
a new terminal is created.
lua
lua require("harpoon.term").gotoTerminal(1)             -- navigates to term 1


 Commands to Terminals
commands can be sent to any terminal
lua
lua require("harpoon.term").sendCommand(1, "ls -La")    -- sends ls -La to tmux window 1

further more commands can be stored for later quick
lua
lua require('harpoon.cmd-ui').toggle_quick_menu()       -- shows the commands menu
lua require("harpoon.term").sendCommand(1, 1)           -- sends command 1 to term 1


 Tmux Support
tmux is supported out of the box and can be used as a drop-in replacement to normal terminals
by simply switching 'term' with 'tmux' like so

lua
lua r

Top issues

Discussions

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON