在git的ANSI颜色显示不正确 [英] ANSI color in git is not displayed correctly

查看:144
本文介绍了在git的ANSI颜色显示不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我切换到SLES 11,我发现的git命令的一个问题。所有的ANSI颜色无法呈现。相反,它显示了ANSI code是这样的:

Recently, I switched to SLES 11. I found a problem for git command. All the ANSI color could not be rendered. Instead, it shows the ANSI code like this:

* ESC [33米 *提交0a02124a0fd85c1f0094bcdf15bac1645e3c8630ESC [M

*ESC[33m*commit 0a02124a0fd85c1f0094bcdf15bac1645e3c8630ESC[m

请注意:在LS的作品ANSI色非常好

note: the ansi color in 'ls' works very well.

推荐答案

尝试设置你的 LESS 环境变量包含 -R 选项:

Try setting your LESS environment variable to include the -R option:

LESS=-R git grep ...

如果这个工程,添加减少出口= -R 你的〜/ .bashrc中〜/ .profile文件或类似的shell启动文件。

If this works, add export LESS=-R to your ~/.bashrc or ~/.profile or similar shell startup file.

   -R or --RAW-CONTROL-CHARS
          Like -r, but only ANSI "color" escape sequences are
          output in "raw" form.  Unlike -r, the screen
          appearance is maintained correctly in most cases.
          ANSI "color" escape sequences are sequences of the
          form:

               ESC [ ... m

          where the "..." is zero or more color specification
          characters

这篇关于在git的ANSI颜色显示不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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