Most git commands require you to either write or update a message. Typically, when you resolve a merge conflict or you try to modify a commit it opens up an editor for you to make the change. While this is not particular to Linux, on Linux systems you ussually have the option of using Emacs or Vim. By default git will use Emacs which in some cases can be annoying if you don’t know how to use it.
In this article we are going to learn how to change the default editor to Vim so that any time you need to update a commit message or anything like that you get Vim to open up. Besically using the command below you can change the default editor to Vim
git config --global core.editor "vim"
This updates systemwide so you never have to worry about using Emac or any other editor.
Additionally, there’s a way to also set Vim for other programs as well, set the standardized VISUAL
and EDITOR
environment variables in your terminal resource file (.zshrc, .bashrc, config.fish etc.)
export VISUAL=vim export EDITOR="$VISUAL"
That’s all folks! Next time you use git, Vim becomes the default editor!
Discussion about this post