KiTTY
KiTTY copied to clipboard
Poor man's syntax highlighting
Since the forum seems to be closed, I'l post this here. This is an enhancement request, and a suggestion for a workaround to get syntax highlighting. Very handy when configuring routers and could also help when looking for certain text in logs.
In current versions of Kitty, you can (mis-)use the URL highlighting feature to underline words

My example pattern highlights Enabled, Up, Down and IP addresses:
(Enabled|Up|Down|([0-9]{1,3}\.){3}[0-9]{1,3})
It would be even better if you could have a list of regular expressions with colours, for example: Up->green, down->red and IP Addresses->blue. Hopefully this will inspire someone to implement this... the URL highlighting patch is probably a good place to start :wink:
Hi @cyd01 ,
I suggest to copy/move/link this in the Wiki and close this issue.
What you think?
Like @kellerza wrote, this is an enhancement request which is not fulfilled or denied, yet.
But the workaround to highlight keywords as links could be moved to a wiki.
Here is a suggestion:
Another way to implement this "Poor man's syntax highlighting" could be to have multiple RegEx fields with individual options/font settings.
Example:
| field name | user defined Value |
|---|---|
| RegEx 1 | (((((https?|ftp|svn)://)|www.)(([0-9]+.[0-9]+.[0-9]+.[0-9]+)|localhost|([a-zA-Z0-9-]+.)[a-zA-Z0-9-]+.(com|net|org|info|biz|int|gov|name|edu|[a-zA-Z][a-zA-Z]))(:[0-9]+)?((/|?)[^ "][^ ,;.:">)])?)|(mailto://[a-zA-Z0-9-.]+@[a-zA-Z0-9-.]+.[a-z]{2,})) |
| font settings 1 | underlined, clickable |
| RegEx 2 | (up|enabled) |
| font settings 2 | green, underlined |
| RegEx 3 | (down|disabled) |
| font settings 3 | red, bold |
| RegEx 4 | (notconnected|([0-9]{1,3}.){3}[0-9]{1,3}) |
| font settings 4 | bright cyan |
| RegEx 5 | (down|disabled) |
| font settings 5 | white, red background |
So I would think these options/font settings would make sense:
- clickable (for hyper links)
- font color (the usual 16 colors (including bright), I guess) https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit
- background color
- font style (bold, underlined, blink??)
What I personally do not need (to reduce the effort for the developer):
- 256 colors
- color picker or checkboxes for font style The user can just type the name of the colors and styles (e.g. `red, bold,
If Kitty had this feature it would make managing my switches and routers much more comfortable. 🤩
What do others think? Would you need more or less options? How many RegEx fields would be best?
Hi @CWempe ,
What do others think?
I think it's an interesting idea.
Indeed @CWempe my idea was multiple RegExes with individual results. Look at this screencast to see it in action.
Limited colors is not an issue, just basic ANSI colors should be ok. Even if this is only configurable in config files it will be acceptable.
Maybe 8 regexes? Will probably have to see when this has a performance hit.
@cyd01 Any thoughts from your side?
Do you think this would be possible to implement?
Limited colors is not an issue, just basic ANSI colors should be ok. Even if this is only configurable in config files it will be acceptable.
Maybe it would make sense to link the RegExes to the colors defined under Window > Colours instead of custom colors for each RegEx.

This would make it compatible with putty color schemes.
But I would be happy either way.
Issue closed due to inactivity
No worries, I've been using labctl color to do the highlighting.
It works nicely with most terminals: Kitty / Windows Terminal / inside VSCode