Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git Merge message issue (Vim?)

Tags:

git

vim

I'm starting to learn git, and am on Ubuntu 20.04.

When I make the command git merge master, it brings me to a (I think) Vim window to enter the merge message. The problem is, when I press Esc, and then hit : to do :wq, it starts recording a macro.

But then it doesn't even seem like Vim. As a sanity test, if I enter the "Vim window" (the one that I go into after running git merge master), and I press Esc j, it goes into some [justified file] mode, and goes all the way to the bottom of the text (instead of like normal, going down one line).

Why is it doing this? What is this?

like image 203
Chris Avatar asked Aug 27 '26 19:08

Chris


1 Answers

Run

git var GIT_EDITOR

to know which editor git is using. Once you know which editor you use, you’ll be able to look for specific help for this editor. You can set the editor used by git with git config --global core.editor vim (for instance).

Git chooses the editor to use based on (in this order) and the previous command git var GIT_EDITOR goes through this:

  1. The environment variable $GIT_EDITOR
  2. Value of core.editor in the configuration file (check with git config core.editor)
  3. The environment variable $VISUAL
  4. The environment variable $EDITOR

Note: In general, the value of an environment variable $VAR can be checked with echo $VAR in your shell.

like image 86
Clément Joly Avatar answered Aug 30 '26 10:08

Clément Joly