fmthoma/vgrep

Allow »no style« as option

Opened this issue · 4 comments

It’s currently impossible to say »don’t style line numbers at all«, only to recolor it. A setting to use the default terminal font color would be nice.

@quchen That is a good point.

I see two alternatives currently:

  1. Either change the config behavior to completely override the default config (rather than augmenting it). Then an empty/missing key automatically maps to terminal default colors.
  2. Add something like terminal-default as possible values for both {fore,back}-color and style.

I'm rather inclined to (1), it seems to be the more obvious behaviour overall. The only downside I see is that if users start their config file from scratch, rather than building on the default one, they start with no color at all.
What do you think?

I doubt users start building configs from scratch, given the good support for creating a default. Where would one look up how to even write the config file, if the only documentation already writes a fully functioning, well-documented default?

Same holds for the keybindings: Currently, the default bindings have to be unset explicitly using unset. So when changing the behavior for colors to (1), the same change should apply to the keybindings.

Maybe it's a good idea to look how other projects handle this. I'll look into this.

I just had a look at the code, and in fact the terminal-default value is easily achieved:

This will fall back to the default config for line numbers:

colors:
    line-numbers:
    

⇒ Color config keys without a right hand side are treated as if they were absent.

The following will override the line-numbers config key with the terminal default colors:

colors
    line-numbers: {}
    

⇒ Color config keys with an empty object as value will revert the style to terminal default.

I will include this in the documentation and update the config.yaml.example accordingly.

Keeping this issue open b/c the decision on keybindings is still pending.