2010-11-02 71 views
6

我使用mercurial.el模式与Emacs。当我运行vc-diff,我可以看到差异,但是,不同的是源代码,它没有很好地突出显示:如何在Emacs diff模式下配置高亮显示?

Emacs vc-diff

读这样的diff是困难的。我如何配置Emacs,

  1. 突出显示-+不同颜色的线? (红色和蓝色等)
  2. 突出字差(比如到位桶和GitHub的那样)

回答

13

尝试使用M-X ediff改版,这确实一个ediff,而不是只是一个普通的差异的。这将为您提供文字差异和并排(或顶部/底部)显示。检查出ediff manual

Emacs维客也有一些模式只是普通的差异文件(如你正在看什么) - 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)) 
+0

谢谢!这样可行。我也喜欢'diff-mode-.el'。 – sastanin 2010-11-02 16:51:23

+0

'diff-mode-.el'在这里: Drew 2011-08-20 21:06:29

+0

我检查**“DarkGreen”**和**“DarkRed”**在终端和4/8位(16/256色)终端上添加/删除的颜色都看起来非常棒! – gavenkoa 2011-10-01 18:16:13