2010-11-02 72 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