Skip to content

Icon Placement Right #2349

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

Closed
alex-courtis opened this issue Aug 1, 2023 · 14 comments · Fixed by #2839 or #2846
Closed

Icon Placement Right #2349

alex-courtis opened this issue Aug 1, 2023 · 14 comments · Fixed by #2839 or #2846
Labels
feature request PR please nvim-tree team does not have the bandwidth to implement; a PR will be gratefully appreciated QOL Quality Of Life Improvement

Comments

@alex-courtis
Copy link
Member

Can this functionality be implemented utilising API?
No, it's internal behaviour.

Describe the solution you'd like
Show icons: git, diagnostic, modified at the far right side of the tree.

Describe alternatives you've considered
Right sign column, not possible.

Additional context
#2348

@alex-courtis
Copy link
Member Author

Requires #1510

@alex-courtis
Copy link
Member Author

Possible values: "right" "end" "rightest"

Silently move placement from renderer.icons to git modified `diagnostics.

@alex-courtis alex-courtis added PR please nvim-tree team does not have the bandwidth to implement; a PR will be gratefully appreciated QOL Quality Of Life Improvement labels Aug 1, 2023
@vollowx
Copy link

vollowx commented Oct 2, 2023

I currently know nothing about how this plugin renders nor writing complex lua plugin, so I'm sorry but still not able to make a PR to implement this feature. The only thing I know is that this may be implemented by vim.api.nvim_buf_set_extmark. If nobody makes PR, will you or when will you implement it by yourself?

@alex-courtis
Copy link
Member Author

This issue is open and is a candidate for implementation, however will likely only be implemented when a kind contributor builds it.

@mr2rm
Copy link

mr2rm commented Apr 21, 2024

@alex-courtis If you still have not picked that up, I think I can work on it.

@alex-courtis
Copy link
Member Author

That would be fantastic @mr2rm !

I have been wanting this one for a while.

@mr2rm
Copy link

mr2rm commented Apr 25, 2024

I've just started working on this issue. I came up with the idea to add a new option to renderer.icons which only applies to all the placements with an after value. If implemented like this, we would have more flexibility to place some of the icons in the before position or on the sign column. I would suggest renderer.icons.after_alignment with values left and right.

@alex-courtis What do you think about this idea? Does it work for you?

@mr2rm
Copy link

mr2rm commented Apr 27, 2024

Also, we should decide when there is not enough room for the icons on the right. First, should we place icons on the right relative to the current window width or the max width? In both cases, what should be the behavior when there is no space to show all the icons on the right?

@alex-courtis
Copy link
Member Author

I came up with the idea to add a new option to renderer.icons which only applies to all the placements with an after value. If implemented like this, we would have more flexibility to place some of the icons in the before position or on the sign column. I would suggest renderer.icons.after_alignment with values left and right.

That might not be enough; renderer.icons doesn't have visibility or control over placement.

We'd need to create a new value for the ICON_PLACEMENT enum, say, right. We'd add that to Decorator and Builder:format_line could use it.

@alex-courtis
Copy link
Member Author

alex-courtis commented Apr 28, 2024

First, should we place icons on the right relative to the current window width or the max width?

Current width might be best - some users like various types of dynamic widths and they wouldn't see the icons most of the time.

In both cases, what should be the behavior when there is no space to show all the icons on the right?

Interesting. We could follow the before behaviour and use renderer.icons.padding. Maybe we could try a single far right pad as well, something like:
filename____Y_X_

@mr2rm
Copy link

mr2rm commented Apr 28, 2024

I came up with the idea to add a new option to renderer.icons which only applies to all the placements with an after value. If implemented like this, we would have more flexibility to place some of the icons in the before position or on the sign column. I would suggest renderer.icons.after_alignment with values left and right.

That might not be enough; renderer.icons doesn't have visibility or control over placement.

We'd need to create a new value for the ICON_PLACEMENT enum, say, right. We'd add that to Decorator and Builder:format_line could use it.

Yeah, I've checked the code and of course, we'd need those changes as well. But what do you think about having a setting only for after placements like the one I suggested?

@mr2rm
Copy link

mr2rm commented Apr 28, 2024

First, should we place icons on the right relative to the current window width or the max width?

Current width might be best - some users like various types of dynamic widths and they wouldn't see the icons most of the time.

We've already had the issue of displaying the filename and after icons in the right way. If the window/pane is narrow, icons and some parts of the filenames might be hidden.

In both cases, what should be the behavior when there is no space to show all the icons on the right?

Interesting. We could follow the before behaviour and use renderer.icons.padding. Maybe we could try a single far right pad as well, something like: filename____Y_X_

But if we follow this way, far-right icons might not be aligned correctly.

@alex-courtis
Copy link
Member Author

Yeah, I've checked the code and of course, we'd need those changes as well. But what do you think about having a setting only for after placements like the one I suggested?

I see, I misread. Yes, that may be needed for extra treatment that right will need.

First, should we place icons on the right relative to the current window width or the max width?

Current width might be best - some users like various types of dynamic widths and they wouldn't see the icons most of the time.

We've already had the issue of displaying the filename and after icons in the right way. If the window/pane is narrow, icons and some parts of the filenames might be hidden.

In both cases, what should be the behavior when there is no space to show all the icons on the right?

Interesting. We could follow the before behaviour and use renderer.icons.padding. Maybe we could try a single far right pad as well, something like: filename____Y_X_

But if we follow this way, far-right icons might not be aligned correctly.

That's fair enough. Let's just build it and see how it looks!

@evertonse
Copy link
Collaborator

evertonse commented Jul 14, 2024

I currently know nothing about how this plugin renders nor writing complex lua plugin, so I'm sorry but still not able to make a PR to implement this feature. The only thing I know is that this may be implemented by vim.api.nvim_buf_set_extmark. If nobody makes PR, will you or when will you implement it by yourself?

I've implemented this using this extmark strategy and made a PR #2839.
I've tested a bunch and the rendering holds up just fine as far as I can tell.

alex-courtis added a commit that referenced this issue Jul 21, 2024
…2839)

* feat(icon_placement): Allow right_align icon_placemente for decorator using ext_marks nvim api

* feat(icon_placement): Allow right_align icon_placemente for decorator using ext_marks nvim api

feat(icon_placement): Allow right_align icon_placemente for decorator using ext_marks nvim api

* feat(icon_placement): consolidate doc

---------

Co-authored-by: Alexander Courtis <[email protected]>
alex-courtis added a commit that referenced this issue Jul 21, 2024
@alex-courtis alex-courtis reopened this Jul 21, 2024
alex-courtis added a commit that referenced this issue Jul 28, 2024
…2846)

* feat(icon_placement): Allow right_align icon_placemente for decorator using ext_marks nvim api

* feat(icon_placement): Allow right_align icon_placemente for decorator using ext_marks nvim api

feat(icon_placement): Allow right_align icon_placemente for decorator using ext_marks nvim api

* feat(icon_placement): consolidate doc

* fix: extra namespace added to avoid colision between right_align and full_name features

* style: rename namespace_id

---------

Co-authored-by: Alexander Courtis <[email protected]>
evertonse added a commit to evertonse/nvim-tree.lua that referenced this issue Jul 28, 2024
…lacement (nvim-tree#2846)

* feat(icon_placement): Allow right_align icon_placemente for decorator using ext_marks nvim api

* feat(icon_placement): Allow right_align icon_placemente for decorator using ext_marks nvim api

feat(icon_placement): Allow right_align icon_placemente for decorator using ext_marks nvim api

* feat(icon_placement): consolidate doc

* fix: extra namespace added to avoid colision between right_align and full_name features

* style: rename namespace_id

---------

Co-authored-by: Alexander Courtis <[email protected]>
alex-courtis added a commit that referenced this issue Aug 10, 2024
…files below the tree (#2856)

* feat(icon_placement): Allow right_align icon_placemente for decorator using ext_marks nvim api

* feat(icon_placement): Allow right_align icon_placemente for decorator using ext_marks nvim api

feat(icon_placement): Allow right_align icon_placemente for decorator using ext_marks nvim api

* feat(icon_placement): consolidate doc

* fix: extra namespace added to avoid colision between right_align and full_name features

* feat(hidden_display): Allow fine grained rendering of hidden files in
a folder

* feat(hidden_display): update defaults in Builder to allow rendering

* feat(hidden_display): Rename opts function name for the feature

* feat(#2349): add "right_align" option for renderer.icons.*_placement (#2846)

* feat(icon_placement): Allow right_align icon_placemente for decorator using ext_marks nvim api

* feat(icon_placement): Allow right_align icon_placemente for decorator using ext_marks nvim api

feat(icon_placement): Allow right_align icon_placemente for decorator using ext_marks nvim api

* feat(icon_placement): consolidate doc

* fix: extra namespace added to avoid colision between right_align and full_name features

* style: rename namespace_id

---------

Co-authored-by: Alexander Courtis <[email protected]>

* docs: update docs

* feat(hidden_display): Simplification and better performance by not sorting and grouping virtual lines

* Update doc/nvim-tree-lua.txt

Co-authored-by: Alexander Courtis <[email protected]>

* style: hidden_stats is better

* docs: change to hidden_stats

* add separate namespace for virtual lines

* help: add highlight group

---------

Co-authored-by: Alexander Courtis <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request PR please nvim-tree team does not have the bandwidth to implement; a PR will be gratefully appreciated QOL Quality Of Life Improvement
Projects
None yet
4 participants