-
-
Notifications
You must be signed in to change notification settings - Fork 396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[harpoon 2] Ability append item to list with any index #436
Comments
I need this. I want to be able to do something like this, because the item I am appending is not in the buffer: require('harpoon'):list():append({ value = rel_file_path, index = 3 })
-- or
require('harpoon'):list():append({ value = rel_file_path }, 3) |
Actually in lua there isn't difference between list and object. So it would be like that: require('harpoon'):list():append({ value = rel_file_path, index = 'q' })
require('harpoon'):list():append({ value = rel_file_path, index = 'any_specific_index' }) |
Seems like #400 somewhat addresses this? |
Yes, it's similar, but it doesn't allow this case: |
I did simple local implementation without ui (actually, i have never used it), so i don't need harpoon.
local function get_marks_component()
return {
enabled = function()
return require('local_plugins.marks').active_mark_index ~= nil
end,
provider = function()
return require('local_plugins.marks').active_mark_index
end,
}
end
return {
dir = './',
event = 'BufReadPre',
config = function()
require('local_plugins.marks'):setup()
end,
} I'm not going to do separated plugin, but who knows:) |
I have to have a very compelling reason to accept any form of this Please convince, as I don't want the complexity and I don't think the use case is real |
The main problem for me is i can't memorize items order:) |
We have replace for this operation |
For me it boils down to wanting to pick which hotkeys go to which files (so I can consistently have |
@sartak great explanation! |
I'm trying to move from harpoon to harpoon 2 and I'm having a hard time believing this is not built-in in harpoon 2 since it was working just fine on harpoon 1. So, am I missing something obvious or is the following code really not doable anymore in any way in harpoon 2? vim.keymap.set('n', '<M-j>', '<cmd>lua require("harpoon.ui").nav_file(1)<Enter>', opts)
vim.keymap.set('n', '<M-k>', '<cmd>lua require("harpoon.ui").nav_file(2)<Enter>', opts)
vim.keymap.set('n', '<M-l>', '<cmd>lua require("harpoon.ui").nav_file(3)<Enter>', opts)
vim.keymap.set('n', '<M-;>', '<cmd>lua require("harpoon.ui").nav_file(4)<Enter>', opts)
vim.keymap.set('n', '<M-S-j>', '<cmd>lua require("harpoon.mark").set_current_at(1)<Enter>', opts)
vim.keymap.set('n', '<M-S-k>', '<cmd>lua require("harpoon.mark").set_current_at(2)<Enter>', opts)
vim.keymap.set('n', '<M-S-l>', '<cmd>lua require("harpoon.mark").set_current_at(3)<Enter>', opts)
vim.keymap.set('n', '<M-:>', '<cmd>lua require("harpoon.mark").set_current_at(4)<Enter>', opts) Just to clarify my use case is that often for each feature I'm developing I have the same types of files open depending on the type of feature: when developing APIs I often have the test (j), the class I'm implementing (k) and dependencies it calls (l and ;), if I'm developing an UI with Angular I'll have the html (j), the component logic (k) and services related to the feature (l and ;). Having the ability to map a key to a type of file depending on what I'm developing is what made me love harpoon 1 and with the above code it's easy to do it just by adding shift to set or replace the index. If for harpoon 2 I have to manually reorder the files using the menu whenever I want to change a file I'm not sure if the upgrade will be worth it for me. |
I'm planning on doing another round of harpoon development and rounding off any of these bugs in the next 2 weeks I very well may add this feature |
@thomazmoura |
You mean like the one on #400 ? It would be fine by me. But so far it seems to me that Primeagen won't fix this because the way it is now already suits all his needs - and it doesn't seem like having things that were supported on version 1 be unsupported on version 2 is a big deal for him, which is reasonable. I'm still using version 1 and it's being suiting me as well so I'm fine with being "stuck" on version 1 for now (it seems like the new features don't really affect my workflow anyway). |
What issue are you having that you need harpoon to solve?
I would like to try using harpoon like window manager. I mean, I want to know exactly, that my file will be available by my shortcut, but i don't have opportunity to connect buffer with necessary key.
For example:
In other words don't use list like array, but like map.
Why doesn't the current config help?
Nope
What proposed api changes are you suggesting?
Change append method or better to add another one like insert.
And mb change
next
andprev
methods to skip empty indexes in list.And
length
.The text was updated successfully, but these errors were encountered: