How to configure gedit as git core.editor?
Asked Answered
V

3

30

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
Veiling answered 18/10, 2013 at 17:45 Comment(0)
D
34

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"
Dahliadahlstrom answered 4/1, 2017 at 17:2 Comment(3)
Interesting to know. +1Panayiotis
It only crashes when you combine -w and -s. Both -w and -s work when used independently. But it seems that -s implies -w...Ema
Both answers were valid, but this worked on Ubuntu 19.xNevus
P
27

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)

Panayiotis answered 18/10, 2013 at 19:20 Comment(9)
@Fortisimo good point. I have included your comment in the answer for more visibility.Panayiotis
To install gedit 3 for linux mint: sudo apt-get install gedit-common/trusty sudo apt-get install gedit/trustyGyrocompass
@GáborLipták is it still called gedit? Does the config works in that case?Panayiotis
Yep the config above works only with gedit 3. With gedit 2 it throws an error, that -w is not known as argument. The APT command above installs gedit 3 on a linux mint mate 17.3.Gyrocompass
@GáborLipták Great! I have included your comment in the answer for more visibility.Panayiotis
From my tests, only -s is required.Unicef
@Jocelyndelalande "which makes it compatible with gedit": you mean compatible with gedit 2 as opposed to gedit 3?Panayiotis
@vonc Yep, sorry, but that was wrong. Failed on my side, I since edited to state something true :-).Unicef
I had the same issue on Ubuntu 18.10. Using just -s works perfectly for me as well. Thanks @PanayiotisIncogitant
V
2

for those interested: under ubuntu 18 gedit with -w is crashing under a segfault

enter image description here

but with -s is charming fine

so please do:

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

Vardar answered 29/1, 2021 at 17:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.