-
-
Notifications
You must be signed in to change notification settings - Fork 846
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Colourful output on Windows (in Git Bash) #469
Comments
Thank you for the feedback. How do you run Could you try to run |
Could you please run
and check if the If not, could you please show the content of |
No escape sequences, only normal characters.
|
(I guess this is just a copy-and-paste error, but there shouldn't be any spaces in Could you please run |
Note that the comment on #129 about termcolor does not apply any more: termcolor supports truecolors and ansi256 colors. |
@sharkdp I had no better idea to put it up on GitHub because the output is a single line, which would look idiotic with a horizontal scrollbar. Ran it with subdirectories. No escape sequences or anything is printed. Ran it with hidden directories, something with Feels like the binary doesn't want to output colours at all.
|
Which Windows version are you on? Could you please show the output of (run this in a new, temporary directory): mkdir test_directory
touch test.md test.txt
fd --color=always | cat -A
echo
export LS_COLORS="di=01;34:*.md=01;31"
fd --color=always | cat -A |
Ok, thank you. The reason that this happens is the following: Lines 125 to 129 in b027b2c
Lines 133 to 134 in b027b2c
If you have So even though your terminal emulator would actually already support ANSI escape sequences, I think there are a few ways forward:
|
You have managed to turn off escape sequences in |
Yes, of course. We already do this. That's the The problem is the second part. So far, we wanted to disable color support on Windows if |
The way that
|
Just ran into this. I think
Currently that case is not handled. Im not sure how to fix it, but |
I would be okay with the |
fixed via #570 |
This has now been released in fd v8.0. |
I compiled fd with @lzybkr's suggestion and it works on my up-to-date Windows 10 machine. It just needs to be tested on an older distribution of Windows I assume. |
@lzybkr @ImportTaste Thank you for your feedback. I'm not sure I can follow. We already use this code in the current version of Lines 160 to 161 in 78cde85
This means that we will disable color support if What I thought this issue is really about: there are some terminals that DO support ANSI escape sequences, even on older Windows versions (I have explained this here: #469 (comment)). At the moment, users will not see colored output on these terminals, due to |
I am proposing the following fix: #601. It changes two things:
It would be great if some users of older and newer Windows versions could test #601. |
I have released this as v8.1.1: https://github.com/sharkdp/fd/releases/tag/v8.1.1 It would be great if someone could test this and report back. |
I'm on Windows 10 19041 and I'm not getting any color from the command prompt with --color=always or with TERM set. |
And |
Correct. |
@lzybkr Ah, I see. I'm getting colors in powershell, but not cmd. Try doing it in cmd. |
Colors in cmd as well - using Windows Terminal. |
And colors in cmd not using Windows Terminal - regular conhost. |
Okay, my apologies, I was expecting the color on the search command I tried to spit out yellow names like it shows in the Demo ( So, I guess color is working, because it colors paths blue. |
Thank you both! There are a few other (obvious?) requirements that colors work:
|
Ah, I see. If you want to have similar settings as in the demo, try setting the
|
The name of the variable is |
Oh, I seem to be an idiot. Ok, it works, sorry about that. |
No worries. I think we should update the Installation/Windows section in the README to inform Windows users about the How are environment variables permanently set in PowerShell/cmd.exe? |
cmd uses setx (defaults to current user, to set it on local machine you use the /m switch) For PowerShell: [Environment]::SetEnvironmentVariable("LS_COLORS", "VALUE", 'User')
[Environment]::SetEnvironmentVariable("LS_COLORS", "VALUE", 'Machine') Though PowerShell can use setx as well. There is a way to do this through native cmdlets and not the .NET method, but it's needlessly complicated. |
Another option would be to ship Concerning this ticket: We now know that colors work on Windows 10 with cmd and PowerShell. However, the ticket was originally opened by someone running "Win7 x64 SP1" and using Git Bash. Can someone please report back if colors work in this setting? |
Colors works running Windows Server 2008 and using Git Bash (git 2.26.0, nor LS_COLORS nor NO_COLORS are set) but it is much slower than with |
That is somewhat expected. Without colors, we don't have to print any ANSI escape codes. Terminal rendering will also be faster. |
@sharkdp Ever since I moved my personal computer to Win 10, but still using Git Bash, I can check for you once I'm out of work. |
Windows Server 2008 R2 is a server variant of Windows 7 and have both SP1. |
|
Huh! It wasn't making executable colourful by default! Doing it somewhere where I have |
I've seen the talks leading up to colour output support, namely #129 #137
However,
bat
works and emits a colourful output, by default. Below isbat ~/Desktop/desktop.ini
:It seems colourful output can be supported.
I'm using Git Bash 2.20-something. Git Bash can be set up to run with MinTTY, which gets you a nice terminal emulator, unlike that of the default
cmd
. Git Bash is the nicest and best way to get Bash shell environment running for Windows, and this is like the only Shell I use on Windows, so it's surprising that ifbat
colours work,fd
does not.The text was updated successfully, but these errors were encountered: