Before diving into specific issues, run these quick checks:
-- Check Harpoon version and config:lua require("harpoon").print_config()-- Check current marks:lua require("harpoon.ui").toggle_quick_menu()-- Check cache location:echo stdpath("cache")-- Check data location :echo stdpath("data")
Understand path normalization:Harpoon stores paths relative to the project root (current working directory). If you change directories, marks may not resolve correctly.
-- Check your current working directory:pwd-- Marks are stored relative to this directory:lua print(require("harpoon.utils").project_key())
Use consistent working directories:Always start Neovim from your project root:
# Goodcd ~/my-projectnvim# Problematic - working directory is ~cd ~nvim my-project/file.lua
For git projects with branch-specific marks:
require("harpoon").setup({ global_settings = { mark_branch = true, -- Separate marks per git branch }})
With mark_branch = true, switching git branches will switch to that branch’s marks. This is useful for feature branch workflows but can be confusing if unexpected.
Check symbolic links:Symbolic links can cause path resolution issues. Harpoon normalizes paths, but symlinks may not resolve as expected. Use absolute paths or avoid symlinks in your project structure.
Bufferline / Tabline plugins:If using Harpoon’s tabline feature:
-- Disable other tabline plugins or disable Harpoon's tablinerequire("harpoon").setup({ global_settings = { tabline = false, -- Let other plugin handle tabline }})
Telescope:If Telescope integration isn’t working:
-- Load extension after both plugins are loadedrequire("telescope").load_extension('harpoon')-- Then use::Telescope harpoon marks
Session managers:Session plugins might restore buffers that conflict with Harpoon marks. Load Harpoon after your session manager.File tree plugins (NvimTree, neo-tree):Ensure file trees are in the excluded_filetypes:
Reduce mark count:Harpoon is designed for a small set of frequently accessed files (typically 4-10). If you have dozens of marks, consider using other tools like buffers, tabs, or a fuzzy finder.Optimize save behavior:
require("harpoon").setup({ global_settings = { save_on_toggle = false, -- Only save on change, not on toggle save_on_change = true, -- Keep this true for persistence }})