-
-
Notifications
You must be signed in to change notification settings - Fork 378
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: Improve telescope setup documentation #471
base: harpoon2
Are you sure you want to change the base?
Conversation
Quick question: To remove the clutter in readme can't we just modify and make marks.lua requirable? |
@nirmitjoshi mark.lua is legacy harpoon. Harpoon 2 Is the new harpoon. If you modify that, I will not merge it :) |
@greidinger-reis can you also add default keymaps for re-arranging files, just to make the functionality more clear |
@nirmitjoshi I'm trying to get that done, but telescope doesn't provide any functions to easily re-arrange list items, so I'm having some trouble implementing my own, since I'm relatively new to telescope |
It looks like there is an implementation of that in |
There you go. I added a mark rearranging feature to the PR. However this makes this setup a lot longer, it might be time to rewrite it into a harpoon2 telescope plugin. |
+1 |
Hello, Furthermore this issue of partial telescope support, incomplete readme.md, no native support for terminals make me wonder why v1 is "deprecated". Active development in on v2 but v2 seems experimental. Also you may want to add a tag or a branch for v1 so people don't have unexpected breaking changes. Anyway for anyone wanting to switch from v2 to v1 if you a bug saying can't derefence config of nil init.lua:270 (or something like that) you should |
I've tried this and it almost works. The remaining items after re-opening Telescope represent an incomplete list. For instance, if you initially have 5 items, and delete just one, then close Telescope and re-open it once again, you will find only 2 items in the list, when there should be 4 items. Anyone else experiencing the same issue? |
This works great: #512 |
@gvolpe Yes, I noticed this bug, I got it working by using a indexOf helper function to get the index of the mark in the list correctly. Here it is if you want, and I will include it in this PR local function list_indexOf(list, predicate)
for i, v in ipairs(list) do
if predicate(v) then
return i
end
end
return -1
end Use it in the map({ 'n', 'i' }, '<C-d>', function(prompt_bufnr)
local curr_picker = action_state.get_current_picker(prompt_bufnr)
curr_picker:delete_selection(function(selection)
local mark_idx = list_indexOf(harpoon_files.items, function(v)
return v.value == selection[1]
end)
if mark_idx == -1 then
return
end
harpoon:list():removeAt(mark_idx)
end)
end) |
The current documentation in
README.md
on setting Harpoon 2 with telescope is incomplete.It does not open the buffer you selected in the picker with
<CR>
It does not have any way to remove a buffer from the list using the picker.
The code snippet added to
README.md
in my commit is going to help users that would like to use Harpoon 2 with telescope.