如何在ConEmu + Git Bash中正确启用ANSI颜色? [英] How to correctly enable ANSI colors in ConEmu + Git Bash?

查看:270
本文介绍了如何在ConEmu + Git Bash中正确启用ANSI颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将 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 :

  1. 下载并提取 ANSICON : https://github.com/adoxa/ansicon/releases/tag/v1.81
  2. 如果您正在运行 64位操作系统 ,请复制 x64 文件夹中的所有内容,否则,
    • 如果您正在运行 32位操作系统 ,请复制 x86 文件夹中的所有内容.
  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.

  1. 目标值设置/修改为以下值(请参见下面的屏幕截图):
  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

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

  1. 打开您的 .bashrc 文件(C:\ Users \ Aditya \ .bashrc).
  1. 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.

  1. 将以下两行添加到您的.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

  1. 保存您的 .bashrc 文件并立即打开Git Bash.完毕!
  2. 非常棘手
  1. Save your .bashrc file and open Git Bash now. Done!

这篇关于如何在ConEmu + Git Bash中正确启用ANSI颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆