[How To] set vim as GIT editor

You can change the default editor used by Git by setting the core.editor configuration variable to the path of the editor you want to use. To set the editor to Vim, you can use the following command:

git config --global core.editor "vim"

This will set the core.editor variable for your global Git configuration, so it will be used for all of your Git repositories. If you want to set the editor for a specific repository, you can run the command in the repository’s root directory.

Alternatively, you can also set the GIT_EDITOR environment variable to vim in your shell profile (e.g., ~/.bashrc, ~/.zshrc), which will make Git use Vim as the default editor for all Git commands.

export GIT_EDITOR=vim

It’s important to note that you need to have the ‘vim’ installed on your machine and it should be available in the PATH of your system.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.