ThePrimeagen / harpoon

MIT License
6.25k stars 348 forks source link

nil value with lazy.nvim key setup #561

Closed Archelyst closed 2 months ago

Archelyst commented 2 months ago

This is more of a support request. I have seen other people with this problem, but no solution, so I though it might be worth asking here, especially since you probably immediatedly know what's going wrong.

I'm trying to install harpoon2 with lazy like this:

return {
  "ThePrimeagen/harpoon",
  branch = "harpoon2",
  dependencies = { "nvim-lua/plenary.nvim" },
  keys = {
    {
      "<leader>h",
      function() require("harpoon"):list():add() end
    },
  }
}

When I press <leader>h I get this stracktrace:

E5108: Error executing lua: ~/.config/nvim/lua/plugins/harpoon2.lua:8: attempt to call method 'list' (a nil value)
stack traceback:
        ~/.config/nvim/lua/plugins/harpoon2.lua:8: in function <~/.config/nvim/lua/plugins/harpoon2.lua:8>

I printed out what require() returns, it's a table with setup and a few other things, but no list indeed. I tried callingsetup()` before, same outcome.

What am I doing wrong here?


abeldekat commented 2 months ago

Your config is correct.

For example, see harpoon in LazyVim

Perhaps the old harpoon version is still present? You could try to delete your nvim folders, and download from scratch. Then, check that the correct harpoon version is in ~/.local/share/nvim/lazy.

On linux, I would remove everything with:

rm -rf ~/.local/share/nvim
rm -rf ~/.local/state/nvim
rm -rf ~/.cache/nvim
Archelyst commented 2 months ago

That was it! Thank you so much for taking your time to help me!

abeldekat commented 2 months ago

You're welcome!