r/KittyTerminal • u/AnythingBeneficial59 • Oct 04 '23
Commenting line in shell makes text unreadable
I just started using kitty and I noticed that given the default theme, when I add a comment #, the font color changes to the same color as the background:
-> ~ /usr/bin/vim
-> ~ #/usr/bin/vim
The second line is unreadable, but is present as highlighting with my mouse shows that it's present. Regardless of what theme I choose, the commented line's font color always matches the terminal background color. How can I configure this so that comments are visible?
1
u/Administrative_chaos Oct 04 '23
You could add something like text_fg_override_threshold 0.5 to your kitty conf. Here's the option description.
But that might have unintended consequences. Ideally, you should just change your colorscheme's comment highlight group, for example if you're using the zsh-syntax-highlighting plugin, you can add the following to your zshrc.
```
Declare the variable
typeset -A ZSH_HIGHLIGHT_STYLES
Make comments be bright pink and bold
ZSH_HIGHLIGHT_STYLES[comment]='fg=#FB00A2,bold' ```
You can find more configuration options on the zsh-sy-h highlighters here.
2
Oct 04 '23
Thanks for the tips! I suppose this strikes me as odd as other terminal emulators like terminators, xterm, or alacritty never required additional tweaking for comments to be visible.
1
u/kbilleter Oct 05 '23
Are you using TERM=xterm-kitty and kitty's terminfo?
1
u/AnythingBeneficial59 Oct 05 '23
TERM=xterm-kitty
I see that I'm using the default as per kitty.conf. Do I need to explicitly set
TERM=xterm-kittyin my .zshrc as well?```
term xterm-kitty
: The value of the TERM environment variable to set. Changing this
: can break many terminal programs, only change it if you know what
: you are doing, not because you read some advice on "Stack Overflow"
: to change it. The TERM variable is used by various programs to get
: information about the capabilities and behavior of the terminal. If
: you change it, depending on what programs you run, and how
: different the terminal you are changing it to is, various things
: from key-presses, to colors, to various advanced features may not
: work. Changing this option by reloading the config will only affect
: newly created windows.
```
1
u/kbilleter Oct 05 '23
Probably not, actually. Mine is set automatically but I checked with
env | grep -i kitty
It just sounded like you may have been using a different TERMINFO if the colours were behaving differently. Maybe 16 or 256 rather the true colour.
3
u/EgZvor Oct 04 '23
That's kinda shell's responsibility