Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PhpStorm terminal : Cygwin colors does not work

I have PhpStorm 2016.2 and I added Cygwin in the Shell path as follow : "C:\cygwin64\bin\env.exe" CHERE_INVOKING=1 /bin/bash.exe

It's working well, but the colors do not work. For exemple I have ?[32m Name instead of having Name colored in green.

I tried several things like adding the plugin Grep Console to have the support of ANSI Color, but didn't work.

It's really hard to work with lines with multiple ANSI colors ?[39m ?[32m Scheme ?[39m ?[32m Host ?[39m ?[32m Path.

Do not hesitate to ask further information about the problem. Thank you.

P.S. I'm on Windows 10.

EDIT

when I do /usr/bin/which php in PHPStorm terminal I get /cygdrive/d/wamp2/bin/php/php5.6.16/php. I have php5.6.16 and php7.0.0 in my WAMP and I'm currently using php7.0.0.

EDIT 2 I added a $PATH for php7.0.0 so now I have /cygdrive/d/wamp2/bin/php/php7.0.0/php when I do /usr/bin/which php. But the main problem remains.

like image 241
WillMic Avatar asked Mar 11 '26 07:03

WillMic


1 Answers

Adding second answer to provide an alternative solution to my original answer.

ANSICON Support

First download and install ANSICON

  • Extract the windows binary files (x86 or x64 directory contents) into your $PATH (D:\wamp\bin\php\php7.0.0)
  • Optionally run ansicon -i from a Windows Command Prompt to allow you to use ANSICON to add ansi color support to the Windows Command Prompt.

Next you need to wrap ANSICON for the PHPStorm terminal

"X:\path\to\ansicon.exe" -p "C:\cygwin64\bin\env.exe" CHERE_INVOKING=1 /bin/bash.exe

Ansicon Wrapper

NOTE: Using -l or --login, as stated in the original answer, will add /usr/bin and /usr/local/bin to your $PATH and cause the terminal to use the Cygwin PHP installation making ANSICON unneeded.

Next in your ~/.bashrc file you will need to add at the bottom of the file.

export ANSICON=true

You can easily append the line by running the following command from a Cygwin terminal.

echo export ANSICON=true >> ~/.bashrc

This will ensure Symfony will find the ANSICON environment variable with a different Windows Version.

Next restart PHPStorm and open the terminal to test it out. Composer Ansicon

like image 77
Will B. Avatar answered Mar 14 '26 10:03

Will B.