Skip to content

How to forward ANSI escape codes thru ripgrep? #1920

Answered by BurntSushi
hrls asked this question in General
Discussion options

You must be logged in to vote

The question here is not quite framed right. The issue here isn't whether ripgrep is "forwarding" colors or not. ripgrep prints the bytes it gets exactly as-is. If colors are emitted via ANSI escape sequences, then of course those are sent through as well. Indeed, your example isn't even showing a failure of forwarding colors. What it's showing is that your query for main( doesn't produce any results. Why? Well, I'm guessing it's because bat is emitting ANSI escape codes between main and (, and thus, main( does not match anything.

There's really not much ripgrep can do about this. You either have to ensure that your queries don't overlap with syntax highlighting boundaries, or otherwise e…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@hrls
Comment options

Answer selected by BurntSushi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants