如何在ConEmu + Git Bash中正确启用ANSI颜色? [英] How to correctly enable ANSI colors in ConEmu + Git Bash?
问题描述
我正在将 Git Bash 与
I'm using Git Bash with ConEmu to make it look cool. However, upon installing Composer the colors seem to be escaped:
因此Git Bash不支持所有颜色.检查AnsiColors256.ans文件:
So Git Bash does not support all the colors. Checking the AnsiColors256.ans file:
经过大量Google搜索后,我仍然没有找到任何解决方案.我不想使用Ansicon或其他控制台模拟器,ConEmu对我来说很好.
After lots of Googling, I still haven't found any solution. I don't want to use Ansicon or other console emulator, ConEmu is fine for me.
我的设置:
- 启用注入ConEmuHk
- 启用了Ansi X3.64/xterm 256
- Windows 7 x64
- Git Bash 1.9.5
- ConEmu 141208
如何启用所有颜色?这令人讨厌我需要Console-Zen体验:(
推荐答案
要在Git Bash中正确启用颜色:
To correctly enable colors in Git Bash :
- 下载并提取 ANSICON : https://github.com/adoxa/ansicon/releases/tag/v1.81
- 如果您正在运行 64位操作系统 ,请复制 x64 文件夹中的所有内容,否则,
- 如果您正在运行 32位操作系统 ,请复制 x86 文件夹中的所有内容.
- Download and extract ANSICON : https://github.com/adoxa/ansicon/releases/tag/v1.81
- 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.
- 将目标值设置/修改为以下值(请参见下面的屏幕截图):
- 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
"C:\Program Files\ANSICON\ansicon.exe" "C:\Program Files\Git\git-bash.exe" --cd-to-home
- 打开您的 .bashrc 文件(C:\ Users \ Aditya \ .bashrc).
- Open your .bashrc file (C:\Users\Aditya\.bashrc).
注意: :. bashrc是隐藏文件.因此,您需要在Windows资源管理器设置中打开该选项,以显示隐藏文件.
NOTE: .bashrc is a hidden file. So you need to turn on the option in your windows explorer settings to display hidden files.
- 将以下两行添加到您的.bashrc文件中(任意位置):
unalias $(alias | grep winpty | grep php | cut -d"=" -f1 | cut -d" -f2)
unalias $(alias | grep winpty | grep php | cut -d"=" -f1 | cut -d" " -f2)
export ANSICON = true
export ANSICON=true
- 保存您的 .bashrc 文件并立即打开Git Bash.完毕! 非常棘手
- Save your .bashrc file and open Git Bash now. Done!
这篇关于如何在ConEmu + Git Bash中正确启用ANSI颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!