Skip to content

Commit

Permalink
nvim: harpoon keybinds
Browse files Browse the repository at this point in the history
  • Loading branch information
samialdury committed Nov 5, 2024
1 parent 2bbefc4 commit 43c6418
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .config/nvim/lua/config/keymaps.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ vim.keymap.del("n", "<leader>|")
vim.keymap.set("n", "<leader>\\", "<C-W>v", { desc = "Split Window Right", remap = true })

-- Move to end of line with alt-l
vim.keymap.set("n", "<A-l>", "$")
vim.keymap.set("n", "<S-l>", "$")
-- Move to start of line with alt-h
vim.keymap.set("n", "<A-h>", "^")
vim.keymap.set("n", "<S-h>", "^")

-- Keep the cursor in the middle when scrolling
vim.keymap.set("n", "<C-d>", "<C-d>zz")
Expand Down
38 changes: 38 additions & 0 deletions .config/nvim/lua/plugins/harpoon.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
return {
{
"ThePrimeagen/harpoon",
keys = function()
local keys = {
{
"<leader>a",
function()
require("harpoon"):list():add()
require("notify")("File added", "info", { title = "Harpoon" })
end,
desc = "Add file to Harpoon",
},
{
"<C-e>",
function()
local harpoon = require("harpoon")
harpoon.ui:toggle_quick_menu(harpoon:list())
end,
desc = "Harpoon Quick Menu",
},
}

local arr = { "h", "j", "k", "l" }

for i, key in ipairs(arr) do
table.insert(keys, {
"<M-" .. key .. ">",
function()
require("harpoon"):list():select(i)
end,
desc = "Harpoon to File " .. i,
})
end
return keys
end,
},
}

0 comments on commit 43c6418

Please sign in to comment.