gustavo-hms / peneira

A fuzzy finder crafted for Kakoune
GNU Lesser General Public License v2.1
35 stars 6 forks source link

[Feature Request] file-path highlighting (depth/type/etc) #4

Closed jtrv closed 2 years ago

jtrv commented 3 years ago

It would be nice to add some high-lighters to file-paths so they are more easily parsed by humans. I was thinking we could probably achieve this with regexes: for depth we could work on concurrent .*?/'s and for different file-extensions \.rs$ or \.js$ etc.

gustavo-hms commented 3 years ago

Hi, @JacobTravers ! Sorry for the late reply. I'm very busy these days...

Thanks for the suggestion! Do you mean highlighting path when running the peneira-files filter? If so, I think it can be a good idea, but I need to prototype it first. The problem is that it can visually conflict with the highlighter for the matches, making things harder to read instead of easier.

That's why, for instance, in peneira-lines I deliberately changed the highlighter for the matches, so that it didn't mess things up visually.

But I'll take a look at this suggestion once I get some free time.

Thanks again!

jtrv commented 3 years ago

Yes that was exactly what I was thinking, also I think we could avoid visibility issues by using rgba: for faces so that it's basically a transparent highlighter. My current color scheme does this so that syntax highlighting is still visible under the selection highlighters:

face global Default            rgba:D9D9D9FF,default
face global PrimarySelection   rgba:D9D9D980,rgba:49719EFF+g
face global SecondarySelection rgba:D9D9D966,rgba:304A68FF+g
face global PrimaryCursor      rgba:1E2227FF,rgba:D9D9D9FF+fg
face global SecondaryCursor    rgba:1E2227FF,rgba:A0A4AAFF+fg
gustavo-hms commented 3 years ago

Hi, @JacobTravers !

Sorry again for the late reply...

we could avoid visibility issues by using rgba: for faces

That doesn't work as expected for the following reasons:

  1. peneira refers to the bult-in faces of Kakoune (the faces we tweak when we are creating a new colorscheme, like type, function, PrimarySelection...); this way, it adapts automatically to any colorscheme the user chooses;
  2. once defined, those faces can't be made transparent; that is, I can't tell Kakoune I want to highlight the path using PrimarySelection but with aa as the value for the alpha channel.

That said, I tested some configurations in different colorschemes and came to the conclusion the type face works reasonably well in most configurations.

Also, judging by your comments, it seems you'd like to color differently the extensions (say, green for .rs, yellow for .js, and so on). Well, that doesn't seem to improve usability significantly, but adds lots of complexity to the code, so I decided to don't do that. I hope you don't mind.

In the highlight-names branch, you can test the new code. Please, take a look at that and see if it satisfies you, giving me some feedback otherwise.

gustavo-hms commented 3 years ago

I'm still experimenting with highlighting and decided for a more subtle one. Please, check both version in this branch and tell me what you think about them.

jtrv commented 2 years ago

@gustavo-hms Sorry for taking so long to get around to this! It looks great, I think the subtle version is a good default that will work with other themes well, and we the user can override it in the kakrc in order to customize it like so:

set-face global PeneiraFileName rgb:5CBE97
gustavo-hms commented 2 years ago

Excelent! I'm goona merge it right now then.