1
Fork 0
mirror of https://github.com/thegeneralist01/config.git synced 2026-03-07 10:59:55 +01:00

neovim(harpoon): allow symbols instead of numbers

This commit is contained in:
TheGeneralist 2025-06-27 17:36:21 +02:00
parent a44510ee09
commit eae1c39468
Signed by: thegeneralist01
SSH key fingerprint: SHA256:pp9qddbCNmVNoSjevdvQvM5z0DHN7LTa8qBMbcMq/R4

View file

@ -26,10 +26,29 @@ return {
vim.keymap.set("n", "<C-k>", function() harpoon:list():select(3) end, { desc = '[Harpoon] Third file' }) vim.keymap.set("n", "<C-k>", function() harpoon:list():select(3) end, { desc = '[Harpoon] Third file' })
vim.keymap.set("n", "<C-l>", function() harpoon:list():select(4) end, { desc = '[Harpoon] Fourth file' }) vim.keymap.set("n", "<C-l>", function() harpoon:list():select(4) end, { desc = '[Harpoon] Fourth file' })
vim.keymap.set("n", "<C-]>", function() vim.keymap.set("n", "<C-]>", function()
local dict = {
["!"] = 1,
["@"] = 2,
["#"] = 3,
["$"] = 4,
["%"] = 5,
["^"] = 6,
["&"] = 7,
["*"] = 8,
["("] = 9,
[")"] = 10,
}
local input = vim.fn.input("File number > ") local input = vim.fn.input("File number > ")
local file_number = tonumber(input, 10) local file_number = tonumber(input, 10)
if not file_number then return print(input .. " is not a valid number") end if not file_number and dict[input] == nil then
harpoon:list():select(file_number) return print(input .. " is not a valid number")
end
if file_number then
harpoon:list():select(file_number)
else
harpoon:list():select(dict[input])
end
end, { desc = '[Harpoon] File by number' }) end, { desc = '[Harpoon] File by number' })
-- Set -- Set