Attilio
Attilio

Reputation: 1722

Configure git commit editor colors

What is the parameter to configure the color of the first line (and the body text) of the commit message editor of git? (In case that matters, I am using vim as an editor).

I have found many related resources, but none of them gave the option to specify this color. (For the records, the most relevant hits were the following:

I am beginning to suspect that this option has to be configured somewhere else (e.g. in bash or in vim)...

Upvotes: 8

Views: 8257

Answers (3)

bjnord
bjnord

Reputation: 2744

What I was missing was a GIT_EDITOR environment variable. (Can also be set as core.editor in git config.) When I set that to /usr/bin/vim, the colors showed up in my commit editor session.

Upvotes: 5

Ingo Karkat
Ingo Karkat

Reputation: 172510

As the syntax script for the gitcommit filetype properly uses :hi def link, you can simply overwrite any of its highlightings in your ~/.vimrc:

:hi gitcommitSummary ctermfg=yellow ctermbg=red

No :au FileType gitcommit (as in @ymonad's answer) is necessary.

Upvotes: 4

ymonad
ymonad

Reputation: 12090

To change the color of the title when you are editing the commit message in vim, add following code to ~/.vimrc

au FileType gitcommit
 \ hi gitcommitSummary ctermfg=yellow ctermbg=red

other highlight option can be found by typing :hi in vim command, or from following url

https://github.com/vim/vim/blob/master/runtime/syntax/gitcommit.vim

Upvotes: 6

Related Questions