macos - 提交时如何在 vim 中获得 git diff 着色?

标签 macos git vim git-diff

当我查看 git diff 时,我会看到删除和添加的行的所有漂亮颜色。然而,当我 git commit -av 来读取并拒绝或接受提交时,我所拥有的只是丑陋的单色文本。

我的.gitconfig包含:

[color]
        diff = auto
        status = auto
        branch = auto
        ui = true [core]
        excludesfile = ~/.gitignore
        editor = vim

我知道它可以工作,因为我曾经在 Ubuntu 机器上安装过它。我在 OSX 上虽然已经安装了 git 和 homebrew。

如何获得这些漂亮的颜色?

最佳答案

我必须设置~/.vimrc并添加:

syntax on

关于macos - 提交时如何在 vim 中获得 git diff 着色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21699850/

相关文章:

ios - 使用 MAMP 请求超时 iPhone 到 Mac localhost

git - 我真的把我的存储库弄乱了吗?

bash - 如何在shell脚本中进入文件夹并进行操作

windows - Windows 上的 git 和系统变量

vim - 管道 ripgrep 搜索结果到 vim 并在确切的搜索位置打开文件

regex - Vim 正则表达式 : why backslash before + and not before *

macos - 如何使用 NSVisualEffectView 向后兼容 OSX < 10.10?

c++ - 在 mac 上的 gnu/clang 编译器中定义相对于可执行文件的框架路径

xcode - 如何创建mac vps(虚拟专用服务器)并通过浏览器访问

macos - 光标在高亮文本中丢失 - Vim