Replies: 6 comments 4 replies
-
That sounds really interesting. This is a good case for a custom decorator #2948 Your decorator could supply
Unfortunately this support has not yet been implented: we need a mechanism to add the decorator and the base class it should extend. |
Beta Was this translation helpful? Give feedback.
-
@alex-courtis Thanks a lot for the reply when trying to achieve this I wrote this code into the bookmarks.lua file:
the problem is i struggle to make the icon/text different on each file - a k a different letters for the different shortcuts I found that if i do
all of the marks get set to "a" or all to "s" even though the vim notify shows that their all different (a s q w) it turns out that it just sets all of the decorators to the last decorator in the nvim tree ( a k a the marked harpoon file that is most further down in the tree). Seems like self is shared. If i don't do self:define_sign(self.icon) and try to return something other than self.icon - if it is a different hl group it throws an error that it doesnt recognise it if it's another letter it writes the letter that's written in the constructor and not the new one. Do you have any idea how i can bypass that and achieve what i want? |
Beta Was this translation helpful? Give feedback.
-
@alex-courtis Thank you for being so helpful and compliant https://github.com/ThePrimeagen/harpoon/tree/harpoon2 - Here's the gitub repo for harpoon. Here's my setup and installation with lazy.lua
Basically it's a plugin made for faster navigation where you have a buffer/list and with harpoon:list():add() you add the current file you are in to a series of relative paths(relative to project root) which would look something like this: To open this buffer which you can edit with all the same vim shortcuts I have set the shortcut
you can get the contents of the list with harpoon:list() as I have done in the getHarpoonList function
In my setup I have bound shortcuts to the different fiiles in this harpoon list -
where M is the alt key. I want to still keep the bookmark functionality but since I saw that #2948 replaced the bookmarks file I have first tried this. I also want to add a different highlight to eacg letter as well as file in tree - "It looks like getHarpoonList is only called once when the explorer is created and stored in a local, hence mappings will be out of date and incorrect you are correct if there was a way to update the list manually i think you might be able to do it in the bufleave function which will update the decorator each time we leave the harpoon menu
The initial problem seems to be that you with the config I added while you see some letters next to the files that are a part of the harpoon list you would for example see for
q lua/myashkov/plugins/harpoon-lualine.lua and not a lua/myashkov/plugins/harpoon-lualine.lua seems like even though we are doing calculateicons(node) we still update the self
but if we try to return something other than self.icon or a tble identical to self.icon you just run into problems both with the hl group and the text. |
Beta Was this translation helpful? Give feedback.
-
I attempted to replicate with this minimal config, however nvim-tree just shows an empty buffer on This all looks reasonable. It does look like using It's clear what additional functionality is required for the user/custom decorator. I'll make sure that's in there when it is implemented and there are clear examples. I think it's best for you to wait for the custom decorators, as your use case extends far beyond the limited set of functionality that's available for the internal decorators. |
Beta Was this translation helpful? Give feedback.
-
@DMyashkov please see #2948 A UserDecorator proof of concept has been created, along with a minimal example to use. I would be most grateful for your testing. |
Beta Was this translation helpful? Give feedback.
-
@alex-courtis Thank you so much, I will try to implement it as soon I can. I've been pretty busy with work lately but I'll update you when i create it. |
Beta Was this translation helpful? Give feedback.
-
I want to integrate harpoon into nvim tree - i have shortcuts alt + a s q w z x for navigating trough files with harpoon(I've already written a function which creates a table - file to letter) I want to add the letter or icon representing where in the harpoon list the file is in any of these:
renderer.icons.*_placement
options may be:"before"
: before file/folder, after the file/folders icons"after"
: after file/folder"signcolumn"
: far left, requires |nvim-tree.view.signcolumn| enabled"right_align"
: far rightbut i can't seem to place custom icons or letters in any of these places.
If anyone knows I would also like to add a border to the files that i want to mark.
Here's the harpoon function
Beta Was this translation helpful? Give feedback.
All reactions