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

Minor: allow specifying character for "space" in -A mode #1056

Closed
garyo opened this issue Jun 11, 2020 · 6 comments
Closed

Minor: allow specifying character for "space" in -A mode #1056

garyo opened this issue Jun 11, 2020 · 6 comments
Labels
feature-request New feature or request good first issue Good for newcomers themes

Comments

@garyo
Copy link

garyo commented Jun 11, 2020

Right now, spaces are visualized as heavy dots:
image
which is fine, but sometimes I'd prefer something a bit less overwhelming, while still being able to count my YAML indent.
It would be a nice addition to allow specifying the unicode char and/or color to use for the space-replacement char.

@garyo garyo added the feature-request New feature or request label Jun 11, 2020
@LordFlashmeow
Copy link
Contributor

I've been poking about in the code, and picking a character is pretty straightforward . The syntax coloring is currently linked to the heavy dot character, which I haven't been able to fix (yet).

The syntax is something like: bat -A --space-char="*" somefile, which isn't terrible.

However, it adds another parameter to preprocessor::replace_nonprintable, so it'll conflict with #1066 (until that's merged) and it feels a little clunky.

This feature adds only a little bloat but sets a precedent for heavy customizations. I think the feature is useful, but I'm not sure if it should be added.

@sharkdp, is this something that should be added?

@sharkdp
Copy link
Owner

sharkdp commented Jul 2, 2020

Thank you for reporting this.

TBH, I'd rather not add a new command-line option for this. There would be so many other things to configure/control on the same level. Maybe we should rather try to improve the default option? I agree that the current display of the space character and the color are maybe a bit too much. How about trying to use a less vibrant color? I'm also fine with a less heavy central-dot character.

@sharkdp sharkdp added themes good first issue Good for newcomers labels Jul 2, 2020
@LordFlashmeow
Copy link
Contributor

Maybe switch to "·" (U+00B7) Middle Dot from "•" (U+2022) Bullet?

I couldn't make the colors work after 10 seconds of fiddling, but here's the difference:

Before After
Screen Shot 2020-07-02 at 12 27 49 AM Screen Shot 2020-07-02 at 12 26 36 AM

@sharkdp
Copy link
Owner

sharkdp commented Jul 5, 2020

Maybe switch to "·" (U+00B7) Middle Dot from "•" (U+2022) Bullet?

Sounds good to me

I couldn't make the colors work after 10 seconds of fiddling, but here's the difference:

You need to adapt assets/syntaxes/02_Extra/show-nonprintable.sublime-syntax if you change the character. This file also needs to be modified if we want to change the color. Note that you have to run bash assets/create.sh and rebuild bat after making a change to that file.

@LordFlashmeow
Copy link
Contributor

Note that you have to run bash assets/create.sh and rebuild bat after making a change to that file.

Aha! That's what I was missing. Is that documented anywhere, or passed on by word of mouth?

@sharkdp
Copy link
Owner

sharkdp commented Oct 2, 2020

Changed in v0.16.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request good first issue Good for newcomers themes
Projects
None yet
Development

No branches or pull requests

3 participants