Force Terminal to Use Gedit for any Text Editing – not vim

terminaltext-editor

I'm learning to program. While following this mission, I typed git commit, which opened up vim. I don't know or want to know vim (no offense to vim lovers). I'd like to have:

  1. terminal open gedit ever time it try to do text editing from the
    terminal; and
  2. gedit release the terminal for further use.

How do I do that?

UPDATE:

Ok. I'm close, but I must be missing something.

Added /Applications/gedit.app/Contents/MacOS/
to /etc/paths

Because I wasn't root, I had to save it to my desktop. Then I had to move it to /etc, so, terminal handled that.

sudo mv paths /etc

Then I changed the editor.

git config --global core.editor "gedit"

after typing

git commit

I received.

error: cannot run gedit: No such file or directory
error: There was a problem with the editor 'gedit'.
Please supply the message using either -m or -F option.

UPDATED 2:
Relaunching terminal fixed the problem.

Thanks everyone.

Best Answer

In order to do this, type

open -a gedit path/to/file

to open and run the gedit application (using the -a switch issues a command to look for gedit in your /Applications directory).

Alternatively, add /Applications/gedit.app/Contents/MacOS/ to your $PATH, which should allow you to open gedit from the terminal as well by simply typing

gedit