Git commit opens two editor panels instead of one for entering a message
When I run git commit
it opens 2 vi editor windows instead of one. The top panel is completely blank. The bottom bar is what I expect to see at startup git commit
. Every time I want to commit, I need to close the top bar with with :q
before I can write a commit message.
Has anyone seen something like this before? What's the solution?
source to share
I don't know why it worked, but I commented out the line in my .vimrc that changed the color scheme.
colorscheme solarized
... Something seems to have fixed the issue. My guess is that git commit wants to use vi without customization, and for some reason opens a secondary panel when a different color scheme is present.
UPDATE:
Fixed by putting a line colorscheme solarized
in my .vimrc in an if block to see if it's git commit
called.
Changed .vimrc:
if $_ != 'git commit'
colorscheme solarized
endif
source to share
I believe the problem is that Git doesn't know which editor you want to use, so it starts vi
by default, starts Vim in compatibility mode.
This can happen with other applications as well, so you can set environment variables VISUAL
and / or EDITOR
(or / as well as git-specific GIT_EDITOR
) ~/.bashrc
to fix this:
EDITOR=vim
VISUAL=vim
Alternatively, you can configure Git yourself to use vim:
git config --global core.editor "vim"
source to share