I would prefer to write my commit messages in Vim, but it is opening them in Emacs.
How do I configure Git to always use Vim? Note that I want to do this globally,
To set EmEditor as the default text editor for Git, open Git Bash, and type:
git config --global core.editor "emeditor.exe -sp"
EmEditor v19.9.2 or later required.
C:\Users\YOUR_USERNAME\.gitconfig
[core]
editor = 'C:/Program Files (x86)/Notepad++/notepad++.exe'
git commit
and press Enter
. It will pop open Notepad++.git config --global core.editor "atom --wait"
Atom needs to be configured to run from the command line for the above to work:
OS X: install shell commands from Atom: menu bar > Atom > Install Shell Commands
Windows: no action required - atom is configured to run from the command line by default
Run this command:
$ git config --global core.editor "/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl"
Or just:
$ git config --global core.editor "subl -w"
For IntelliJ users
When i was trying to git rebase i was getting the following error: 'hint: Waiting for your editor to close the file... code -n -w: code: command not found error: There was a problem with the editor 'code -n -w'.'
The same error showed up when i was trying to associate IntelliJ with Git:
The problem was that I did not have the command code added in my environment PATH variable. And i didn't want to use Visual Studio Code from my terminal. So that is why it prompted "command not found". I solved this by deleting
editor = code -n -w
from the core section in my .gitconfig file. Git worked properly again.
To make vim the default editor for git on ubuntu 20:04 run the following command:
git config --global core.editor vim