feat(show_file_size): optionally show Size Information on right column
Description
This PR make nvim-tree be able to display file size information as a decoration. It uses newly introduced right_align feature to create a column that shows size info. It allows to customization options to display file sizes in a human-readable format (e.g., MB, GB). It also exposes the highlight group NvimTreeFileSize.
Showcase
Setup:
require'nvim-tree'.setup {
renderer = {
size = {
enable = true,
column_width = 12, -- max chars allowed to fill the column
show_folder_size = false,
format_unit = "double", -- or "single" or a custom function
}
}
}
Improvements that could be made:
- Conditionally show file size information based on the current nvim-tree width in both floating and normal views.
EDIT: This improvement were made. We now support conditionally hiding size information based on current width and width cutoff setting as shown below.
https://github.com/user-attachments/assets/b22469a0-c021-415d-8088-44dafd7b8948
The hiding is decently fast because it only does a partial redraw of extra marks as opposed to reloading the whole tree everytime the cutoff is triggered.
This looks great; I'm limited by time however I will get to it.
Looks like we might need special handling for dotted files:
Looks like some inconsistency around right_align icons. Every icon right:
Bookmarks go far far right for dotfiles unless there's another icon.
They lose the final character of the name, in this case bookmarking .clang-format will remove the t.
This is looking fantastic! You are quite the prolific contributor...
A few bugs, some option tweaking and this should be good.
I'll dogfood this foor a week.
Ty, ty. I'll find some time this week to get to those bugs.
Closing as this PR is stale. Please reopen if you wish to continue this work.