How do I quickly jump between a small set of frequently used files?
Answer
Harpoon: mark files and jump with <leader>1-4
Explanation
Harpoon by ThePrimeagen provides instant access to a curated list of files you're actively working on. Instead of fuzzy-finding every time, you mark up to 4-6 files and jump to them with a single keystroke.
Setup (Harpoon 2)
local harpoon = require('harpoon')
harpoon:setup()
-- Add current file to harpoon list
vim.keymap.set('n', '<leader>a', function() harpoon:list():add() end)
-- Open harpoon menu
vim.keymap.set('n', '<C-e>', function() harpoon.ui:toggle_quick_menu(harpoon:list()) end)
-- Jump to files 1-4
vim.keymap.set('n', '<leader>1', function() harpoon:list():select(1) end)
vim.keymap.set('n', '<leader>2', function() harpoon:list():select(2) end)
vim.keymap.set('n', '<leader>3', function() harpoon:list():select(3) end)
vim.keymap.set('n', '<leader>4', function() harpoon:list():select(4) end)
Workflow
- Open a file you'll need frequently
<leader>a— add it to harpoon (slot 1)- Open another important file
<leader>a— add it (slot 2)- Now from anywhere:
<leader>1jumps to file 1,<leader>2to file 2
The harpoon menu
<C-e> opens a floating window listing your harpooned files:
1. src/handlers/auth.go
2. src/models/user.go
3. internal/database/queries.go
4. tests/auth_test.go
You can reorder, remove, or add entries directly in this buffer.
Why harpoon over buffers/tabs
- Buffers: Too many files —
:lsbecomes cluttered - Tabs: Heavyweight — each tab is a layout
- Harpoon: Exactly the 3-5 files you're actively editing, instant access
Tips
- Most developers work with 3-5 files at any time — harpoon is designed for this pattern
- Lists are per-project (per git root)
- Works with Telescope:
:Telescope harpoon marks - With 7k+ stars, harpoon is one of the most popular Neovim navigation plugins
- The mental model: "I have 4 files. 1 is the handler, 2 is the model, 3 is the test, 4 is the config"