2013-10-18 85 views
15

我把gedit配置爲git core.editor。如何將gedit配置爲git core.editor?

git config --global core.editor "gedit" 

這工作正常,除非已經有一個gedit窗口打開。在這種情況下,COMMIT_EDITMSG在現有窗口中打開,gedit立即返回。 Git以空的提交消息結束並失敗。

此網站(http://fabianschuiki.wordpress.com/2012/05/20/use-gedit-as-git-editor/),建議使用 「的gedit -s -w」,但我沒有這些選項(以及--new窗不工作):

$ gedit -V 
gedit - Version 2.28.4 

$ gedit --help 
Usage: 
    gedit [OPTION...] [FILE...] - Edit text files 

Help Options: 
    -h, --help      Show help options 
    --help-all      Show all help options 
    --help-gtk      Show GTK+ Options 
    --help-sm-client    Show session management options 

Application Options: 
    -V, --version     Show the application's version 
    --encoding=ENCODING    Set the character encoding to be used to open the files listed on the command line 
    --list-encodings    Display list of possible values for the encoding option 
    --new-window     Create a new toplevel window in an existing instance of gedit 
    --new-document     Create a new document in an existing instance of gedit 
    --display=DISPLAY    X display to use 

回答

16

的最簡單方法要解決這將是(與Ubuntu的13.10是在3.8.3)

在3.X升級gedit-s(獨立)和-w(等待)可供選擇。
允許(如commentedFortisimo):

git config --global core.editor "gedit -w -s" 

由於Gábor Lipták評論below,這一點也適用gedit3,它安裝有:

sudo apt-get install gedit-common/trusty 
sudo apt-get install gedit/trusty 

(在Linux Mint的)

+1

'''混帳配置--global core.editor 「的gedit -w -s」''' – Fortisimo

+0

@Fortisimo好點。我已將您的評論納入答案中,以獲得更多的知名度。 – VonC

+0

安裝gedit 3 for linux mint: sudo apt-get install gedit-common/trusty sudo apt-get install gedit/trusty –

13

所有信貸VonC答案,但-w使gedit(3.18)在我的Ubuntu 16.04崩潰。雖然沒有正常工作:

git config --global core.editor "gedit -s" 
+0

有趣的知道。 +1 – VonC

+0

只有將-w和-s合併時,它纔會崩潰。 -w和-s獨立使用時都可以工作。但是,似乎-s意味着-w ... – Superole