version-control - 如何在Emacs差异模式下配置突出显示?

标签 version-control emacs diff syntax-highlighting

我在Emacs中使用mercurial.el模式。当我运行vc-diff时,我可以看到diff,但是与源代码不同,它没有很好地突出显示:

读取这样的差异是困难的。如何配置Emacs,

  • 突出显示不同颜色的-+行? (例如红色和蓝色)
  • 突出显示单词差异(就像BitBucket和GitHub一样)
  • 最佳答案

    尝试使用M-x ediff-revision,它执行 ediff 而不是常规的diff。这将为您提供字词差异和并排(或顶部/底部)显示。 checkout ediff manual

    Emacs Wiki还为普通的diff文件(如您所查看的)-check it out提供了多种模式。

    要仅更改当前使用的diff-mode中的颜色,可以执行以下操作:

    (defun update-diff-colors ()
      "update the colors for diff faces"
      (set-face-attribute 'diff-added nil
                          :foreground "white" :background "blue")
      (set-face-attribute 'diff-removed nil
                          :foreground "white" :background "red3")
      (set-face-attribute 'diff-changed nil
                          :foreground "white" :background "purple"))
    (eval-after-load "diff-mode"
      '(update-diff-colors))
    

    关于version-control - 如何在Emacs差异模式下配置突出显示?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4079830/

    相关文章:

    linux - 比较两个目录中的文件并写入增量

    Git - 当你改变分支时文件去哪里了?

    git - 如何查看git存储库中已经存在的行尾类型?

    version-control - Sitefinity 开发环境和源代码控制

    linux - shell 中两个文件的列差异

    python - 你如何解析用 pysvn 创建的 diff 文件?

    version-control - 如何限制 Jenkins 中对 Cobertura 覆盖率报告的访问

    emacs - 如何在emacs中使用[delete]键删除区域

    emacs - 使用 Emacs,我如何缩进/格式化 TXT 文件中的代码段?

    emacs - 使用 Emacs 在尚未打开的文本文件中递归查找和替换