iTerm 2 中的 Git 语法高亮显示

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26070332/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 10:26:21  来源:igfitidea点击:

Git syntax highlighting in iTerm 2

gitsyntaxsyntax-highlightingiterm2

提问by nikoloza

I've just tried to highlight syntax in iTerm 2, but getting no result. I tried config git (Enabling Git syntax highlighting for Mac's terminal), played with iTerm profiles but can't reach at result.

我刚刚尝试在 iTerm 2 中突出显示语法,但没有得到任何结果。我尝试了 config git(启用 Mac 终端的 Git 语法突出显示),使用 iTerm 配置文件播放但无法达到结果。

Actually, I have Colbat2theme from this set: https://github.com/mbadolato/iTerm2-Color-Schemesand my shell looks like this:

实际上,我有这个集合中的Colbat2主题:https: //github.com/mbadolato/iTerm2-Color-Schemes,我的外壳看起来像这样:

and I want it to look like this (but with my color profile):

我希望它看起来像这样(但使用我的颜色配置文件):

Can I do this?

我可以这样做吗?



UPDATE

更新

it only works for git status

它只适用于 git status

采纳答案by nikoloza

@iraklihelped me to do this with oh-my-zsh.

@iraklioh-my-zsh帮助我做到了这一点。

Thanks

谢谢

回答by Irakli

It's very simple

这很简单

git config --global color.ui auto

git config --global color.ui auto

for advanced configuration read this: http://git-scm.com/book/en/Customizing-Git-Git-Configuration#Colors-in-Git

对于高级配置,请阅读:http: //git-scm.com/book/en/Customizing-Git-Git-Configuration#Colors-in-Git



UPDATE

更新

forget to mention it's not iTerm 2 specific

忘记提及它不是 iTerm 2 特定的