Skip to content
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

Feature request: highlight matched part of filename #15

Open
epitron opened this issue Jan 1, 2017 · 2 comments
Open

Feature request: highlight matched part of filename #15

epitron opened this issue Jan 1, 2017 · 2 comments

Comments

@epitron
Copy link

epitron commented Jan 1, 2017

I think it would help with readability if matched substrings were highlighted in some way (eg: with a yellow background).

It would be extra helpful for regular expressions, where the patterns are abstract.

A workaround is to run bfs | grep --color, but this removes all of bfs' beautiful filetype colour coding!

@tavianator
Copy link
Owner

Hmm, I like this idea, but there are a couple complications:

  • Technically, the matched part is either the whole filename or the whole path. That is, with -name '*foo*', the pattern *foo* matches the entirety of the filename. Similarly, for -regex '.*foo.*', the regex matches the entire path. I suppose the most helpful thing is to ignore any leading/trailing wildcards (or, for regexes, maybe use the first capture group?).

  • For more complicated expressions, it may not be clear what the matched part was. For example, -name 'foo*' -a -name '*bar' -o -name '*baz*'. But the simplest cases (just -name 'blah') can be handled.

@epitron
Copy link
Author

epitron commented Jan 1, 2017

Oh, I see. That is problematic.

That also explains why -regex substring didn't match anything.

Could there maybe be an extra mode, or matcher, that's designed more for the use-case of "finding a file"? Something more along the lines of grep? (bfs -grep?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants