How to correctly enable ANSI colors in ConEmu + Git Bash?

前端 未结 3 844
天涯浪人
天涯浪人 2021-01-02 09:08

I\'m using Git Bash with ConEmu to make it look cool. However, upon installing Composer the colors seem to be escaped:

3条回答
  •  隐瞒了意图╮
    2021-01-02 09:41

    To correctly enable colors in Git Bash :

    1. Download and extract ANSICON : https://github.com/adoxa/ansicon/releases/tag/v1.81
    2. If you are running 64-bit OS, copy everything inside x64 folder, Otherwise,
      • If you are running 32-bit OS, copy everything inside x86 folder.
    3. Create a folder ANSICON at C:\Program Files\ANSICON and paste the copied contents here.
    4. Right click on your Git Bash shortcut and go to properties.

    1. Set/Modify Target value to following (refer to the screenshot below) :

    "C:\Program Files\ANSICON\ansicon.exe" "C:\Program Files\Git\git-bash.exe" --cd-to-home

    1. Open your .bashrc file (C:\Users\Aditya\.bashrc).

    NOTE: .bashrc is a hidden file. So you need to turn on the option in your windows explorer settings to display hidden files.

    1. Add following 2 lines to your .bashrc file (anywhere) :

    unalias $(alias | grep winpty | grep php | cut -d"=" -f1 | cut -d" " -f2)

    export ANSICON=true

    1. Save your .bashrc file and open Git Bash now. Done!

提交回复
热议问题