Closed Jeremy5909 closed 2 months ago
@Jeremy5909 I did some digging into the code itself.
Looking at the logs, we can see that this issue is related to a missing package called harpoon
. Let's open up the file ~/.config/nvim/lua/theprimeagen/lazy/local.lua
we examine what is going on around line 7.
Opening up local.lua
, we see the reason why this doesn't work out of the box is a reference to a local directory ~/personal/harpoon
here. Therefore, the program looks for a local installation of harpoon.
As Prime is the developer for harpoon
, he likely has it installed locally as he develops the code and keeps it in a directory structure as demonstrated here.
What we need to do is put harpoon
where the configuration is looking. As the master
branch of harpoon is deprecated (seen here), you will need to install the harpoon2
branch of that repository.
git clone
this repo into ~/.config/nvim
by doing git clone https://github.com/ThePrimeagen/neovimrc.git ~/.config/nvim
git clone https://github.com/ThePrimeagen/harpoon.git ~/personal/harpoon -b harpoon2
.
-b
flag denotes that we should be checking out the harpoon2
branch directly instead of master
Now you should be able to use Prime's Harpoon with this neovim setup.
ThePrimeagen has a video detailing an older version of his setup. While the setup is outdated due to unmaintained nature of packer package manager, the general packages used and remaps that Prime has are relevant. He has added and changed some aspects but the core parts seem to still be relevant, unless I missed something.
When it comes to his harpoon commands, you will want to edit lines 14-17 of ~/.config/nvim/lua/theprimeagen/lazy/local.lua
since the right side of his homerow remapping replaces hjkl
with htns
. This is because Prime uses Dvorak instead of the typical QWERTY setup that most people use. If you use a standard QWERTY board change lines 14-17 from
vim.keymap.set("n", "<C-h>", function() harpoon:list():select(1) end)
vim.keymap.set("n", "<C-t>", function() harpoon:list():select(2) end)
vim.keymap.set("n", "<C-n>", function() harpoon:list():select(3) end)
vim.keymap.set("n", "<C-s>", function() harpoon:list():select(4) end)
to
vim.keymap.set("n", "<C-h>", function() harpoon:list():select(1) end)
vim.keymap.set("n", "<C-j>", function() harpoon:list():select(2) end)
vim.keymap.set("n", "<C-k>", function() harpoon:list():select(3) end)
vim.keymap.set("n", "<C-l>", function() harpoon:list():select(4) end)
From there you should be all set to use the configuration.
Play around with neovim
and the setup and dig into the configuration. Please let me know if you run into any trouble running his setup.
Since you said you are new to neovim, I would highly recommend watching Prime's opinion about how one should get started with the vim in general. He advocates starting with vim motions within your current editor (like VSCode, etc) and advocates for kickstart.nvim if you're new to the process of customizing your neovim editor.
My recommendation is to just delete the ~/personal/harpoon
reference and use the following in packer.lua
:
use({
"ThePrimeagen/harpoon",
branch = "harpoon2"
})
It actually worked. So simple.
Hi.
You can also rename the local.lua
file to harpoon.lua
(optional, but good style)
and then exchange "dir" with the current lazy.nvim installation guidelines from the repo here: https://github.com/ThePrimeagen/harpoon/tree/harpoon2?tab=readme-ov-file#-installation
final code:
-- ~/.config/nvim/lua/jakobheine/lazy/harpoon.lua
return {
"ThePrimeagen/harpoon",
branch = "harpoon2",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
local harpoon = require("harpoon")
harpoon:setup()
vim.keymap.set("n", "<leader>a", function() harpoon:list():add() end)
vim.keymap.set("n", "<C-e>", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end)
vim.keymap.set("n", "<C-h>", function() harpoon:list():select(1) end)
vim.keymap.set("n", "<C-t>", function() harpoon:list():select(2) end)
vim.keymap.set("n", "<C-n>", function() harpoon:list():select(3) end)
vim.keymap.set("n", "<C-s>", function() harpoon:list():select(4) end)
vim.keymap.set("n", "<leader><C-h>", function() harpoon:list():replace_at(1) end)
vim.keymap.set("n", "<leader><C-t>", function() harpoon:list():replace_at(2) end)
vim.keymap.set("n", "<leader><C-n>", function() harpoon:list():replace_at(3) end)
vim.keymap.set("n", "<leader><C-s>", function() harpoon:list():replace_at(4) end)
end
}
Sorry I'm a beginner
I understand that git cloning doesn't work (at least without modification) because
How can I fix this?