feat: support icon matching by filename prefix - #1228
Open
MsfPablo wants to merge 1 commit into
Open
Conversation
Add a new "prefix" section to the icon theme. A configured prefix is matched when a file name starts with it, falling back only after an exact name match and before an extension match. The longest matching prefix wins; ties are broken lexicographically. The default fancy theme now maps the "log" prefix to the existing log icon so that rotated log files like log.lsd.0 get the same icon as *.log files. Includes unit and integration tests. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #726
This PR adds support for matching icons by filename prefix in the icon theme.
A new
prefixsection can be added to an icon theme YAML file. When looking up an icon for a regular file, lsd now checks, in order:name)prefix)extension)The longest matching prefix wins; if several prefixes have the same length, the lexicographically first one is used so the result is deterministic.
The default fancy theme maps the
logprefix to the existing log icon, so rotated log files likelog.lsd.0orlog.2024-01-01are shown with the log icon instead of the generic file icon.Example custom theme snippet
Tests
log.lsd.0renders the log icon (\u{f18d}).🤖 Generated with Claude Code