Set the default EDITOR for you Shell

3) Set the default EDITOR for you Shell

Sometimes you are on the shell prompt and your shell prompt needs you to edit a document, save it, and “give it back” to the shell for processing. This can happen, for example, when you are making a commit for git merge conflict. The shell will look to see if you have a preferred EDITOR set. An EDITOR is any program you use to edit text files. Many old-school Ruby developers still use TextMate for its simplicity and speed, but you can easily use the built-in macOS tool TextEdit too. You can use a shell-based editor, like Emacs or Vim, but you’d have to decide between Emacs and Vim which is beyond the scope of this introduction.

For example, to set TextMate as your editor, in your ~/.bash_profile

export EDITOR='mate -w'