microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
95k stars 8.22k forks source link

Add support for syntax highlighting #6297

Open 42wim opened 4 years ago

42wim commented 4 years ago

Description of the new feature/enhancement

Add support for syntax highlighting specific words like MobaXterm has:

image

This makes finding errors/issues much easier and it's something that I immediately miss when using terminal :-)

DHowett commented 4 years ago

This'll make a nice extension in the future. It's adjacent to search v2, but different enough that it warrants a separate explanation.

DHowett commented 4 years ago

Link: #4000

zhaone commented 1 year ago

Is there any update about this feature? I still can not find any config that enable custom keywords highlight.

kolbasky commented 1 year ago

I can double that. The only reason i still use moba is because of syntax highlight. In iTerm2 on mac it can be achieved with "highlight trigger", which accepts regex and colors. Maybe it would be a good start - no built-in syntax highlighting for different languages, but give users means to set up their own regexes.

zadjii-msft commented 1 year ago

@kolbasky FWIW I'm tracking "do something on a regex" over in #5916. I'm not sure that would scale to the scope of this issue - the OP looks like it'd have a lot of different matches, and terminal-side recoloring is Hard. But it's along the same vein.

zhaone commented 1 year ago

@kolbasky can't agree more. I'll give up moba if this feature was developed.

StrangePeanut commented 1 year ago

Following. Currently using an overpriced paid alternative but would drop it in a heartbeat if this feature were introduced in Windows Terminal.

zadjii-msft commented 1 year ago

@StrangePeanut So, I've kinda got a spec for "regex matching + colorize the matched text" over in #15700. Would something like:

"triggers":[
    {
        "match": "[Ee][Rr][Rr][Oo][Rr]",
        "action": "experimental.colorSelection",
        "foreground": "#ff0000"
    },
]

work for your use case? (just trying to figure out how exactly you're using the "overpriced alternative" 😉 )

StrangePeanut commented 1 year ago

@zadjii-msft Oh wow that's brilliant, thanks! This would fully cover my use case actually.

MagikEh commented 1 year ago

This is exactly what I've been hoping to have, an effectively client side grcat, a program that takes stdout, runs it through a regex filter and colourizes output.

ReK42 commented 1 month ago

:+1: for this feature. There are various tools to do this for individual command output, but nothing I can see that can do it for the entire interactive session without messing up how stdin/out/err and control sequences work.

Perhaps use the TextMate language specification for highlighting rules (*.tmLanguage)? This is widely supported in text/code editors, including VS Code, and has a large library of rules already.

hanyce commented 1 month ago

any update?