How to configure gedit as git core.editor?

ε祈祈猫儿з 提交于 2019-12-03 11:02:25

问题


I have gedit configured as git core.editor.

git config --global core.editor "gedit"

This works fine unless there is already a gedit windows open. In that case, COMMIT_EDITMSG is opened in the existing window and gedit returns immediately. Git ends up with an empty commit message and fails.

This site (http://fabianschuiki.wordpress.com/2012/05/20/use-gedit-as-git-editor/) suggests using "gedit -s -w", but I don't have those options (and --new-window doesn't work):

$ 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

回答1:


The simplest way to solve this would be to upgrade gedit (which is at 3.8.3 with an Ubuntu 13.10)

In 3.x, -s (standalone) and -w (wait) are available.
That allows for (as commented by Fortisimo):

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

As Gábor Lipták comments below, this works with gedit3, which is installed with:

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

(on Linux Mint)




回答2:


All credit to VonC answer, but the -w makes gedit (3.18) crash on my ubuntu 16.04. Works fine without though:

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


来源:https://stackoverflow.com/questions/19455929/how-to-configure-gedit-as-git-core-editor

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!