bfs icon indicating copy to clipboard operation
bfs copied to clipboard

Feature request: highlight matched part of filename

Open epitron opened this issue 7 years ago • 2 comments

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!

epitron avatar Jan 01 '17 02:01 epitron

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.

tavianator avatar Jan 01 '17 21:01 tavianator

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?)

epitron avatar Jan 01 '17 22:01 epitron