Skip to content

group_empty with custom label #2515

@litoj

Description

@litoj

Is your feature request related to a problem? Please describe.
group_empty option allows for joining simple paths into one, resulting in a long path. The same can happen with root_folder_label, but there we can use a custom function that suits our needs and provides usually a shorter label. Such option would be very useful for grouped paths (for me at least).

Describe the solution you'd like
the simplest would be to allow group_empty option to be a function. Or maybe add a separate option in the likes of grouped_folder_label just for the function.

Describe alternatives you've considered
I tried looking into the code if there was an easy way to replace something, but I didn't get beyond some form of recursion. I didn't find a place where the names of the directories would get joined and rendered as a single point to inject my function.

Additional context
I shorten all paths to just their first letters of each word to fit into my little NvimTree window:

function(path)
	path = path:gsub(os.getenv 'HOME', '~', 1)
	return path:gsub('([a-zA-Z])[a-z]+', '%1') .. path:gsub('.*[^a-zA-Z].?', '', 1)
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions