2012-10-26 24 views
4

在我當前的開發環境中,當我在交互模式下運行git rebase--interactive)時,它通常會打開vi並提示我對某些文本文件進行更改,以此來告訴它如何處理rebase。 vi以一種似乎由git確定的方式突出顯示這些文件。 (像「挑」,「南瓜」,等有特殊含義在這方面與git關鍵字高亮顯示不同的顏色。)如何讓emacs使用git的文字着色工作?

我更喜歡VI用emacs,所以我配置的git打開emacs的,而不是(git config --global core.editor "emacs -nw" )。不幸的是,emacs沒有像vi那樣突出顯示git提供的文件。我怎樣才能解決這個問題?


編輯:

如果你不熟悉是一個互動的git底墊中生成的文件,這裏有一個例子:

pick f218f23 A major overhaul of the cucumber integration tests 
pick 601d8f4 A bunch of minor bug fixes and refactoring 
pick 1adc507 Adding and updating documentation for various files. 

# Rebase ff8cb22..1adc507 onto ff8cb22 
# 
# Commands: 
# p, pick = use commit 
# r, reword = use commit, but edit the commit message 
# e, edit = use commit, but stop for amending 
# s, squash = use commit, but meld into previous commit 
# f, fixup = like "squash", but discard this commit's log message 
# x <cmd>, exec <cmd> = Run a shell command <cmd>, and stop if it fails 
# 
# If you remove a line here THAT COMMIT WILL BE LOST. 
# However, if you remove everything, the rebase will be aborted. 
c:\my_project\.git\rebase-merge\git-rebase-todo [unix] (15:50 26/10/2012) 

在這個例子中,關鍵字'選擇',修訂哈希,提交描述和評論都將以不同的顏色突出顯示。

回答

3

要麼有一種模式已經存在於某處(例如作爲magit的一部分),要麼有人必須爲它編寫一個模式(應該相當容易,如果向我們展示一些示例內容以及一些示例內容提示他們有什麼樣的文件名)。

+0

啊,這樣實際上將東西內置到VI呢?這就說得通了。無論如何,我不得不看看magit。我還添加了git的交互式底圖生成的文件樣本。 – Ajedi32