ripgrep: Color doesn't work in windows mintty (git bash)
I can’t get rg to output color in mintty, ie the default term that comes with git for windows and MSYS2. Tried --color always and -p, to no avail. Color works fine (by default) in standard cmd.exe.
Color (--color=auto) works with standard grep in mintty, or at least the grep build that comes with git for windows.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 21 (13 by maintainers)
@retep998 Ah I see now, OK that works! Thanks! My only problem now is figuring out how to detect whether stdout is tty or not inside of mintty. From searching, it seems like the problem is basically unsolveable, although I will note that
grepfromcygwinseems to get it right.gititself seems to have hacked around it and the mintty project doesn’t have a good answer either.sigh
I don’t think you really need the user’s help deciding which to use. If you’re in a Windows console, then the Windows console API will work all the time. If you’re not in a Windows console, then the Windows console API will work none of time and the only other option is ansi escape codes. So I’d probably enable color by default in the Windows console, and elsewhere support color using ansi escape codes only if enabled via
--color=always.