threads / discuss / 26213

git color in commit editor

Subject: git color in commit editor

## tl;dr

6 messages between Jan 6, 2011 and Jan 9, 2011.

replies: 5people: 5as markdown or json

Pavan Savoy· Jan 6, 2011, 06:42 UTC · lore

I am not sure, If this is a right list, Is there a git users mailing list too somewhere out there ? Anyway the question is simple,

I have git version git version 1.5.6.3, on 1 system and get the colors right during a git commit (commit editor being vim..) On another machine with same vim version and same gitconfig and pretty much all the same settings except that the git version is git version 1.6.3.3, I don't have color in the commit editor...

Moving to newer GIT versions didn't help either... What am I missing?

regards, Pavan

Thomas Rast· Jan 6, 2011, 10:06 UTC · re: Pavan Savoy · lore

Re: git color in commit editor

Pavan Savoy wrote:
Show 6 quoted lines
> On another machine with same vim version and same gitconfig and pretty
> much all the same settings except that the
> git version is git version 1.6.3.3, I don't have color in the commit editor...
> 
> Moving to newer GIT versions didn't help either...
> What am I missing?

That's squarely in vim's domain, git does not (and cannot) impose any colors on the editor. So you need to configure vim on the second machine for the highlighting.

-- 
Thomas Rast
trast@{inf,student}.ethz.ch
Matthijs Kooijman· Jan 6, 2011, 10:15 UTC · re: Pavan Savoy · lore

Re: git color in commit editor

Hey Pavan,
Show 5 quoted lines
> I have git version git version 1.5.6.3, on 1 system and get the colors
> right during a git commit (commit editor being vim..)
> On another machine with same vim version and same gitconfig and pretty
> much all the same settings except that the
> git version is git version 1.6.3.3, I don't have color in the commit editor...

Try the ":syntax on" command in your vim (without the quotes, with the colon).

You can put it in your ~/.vimrc file as well (without the colon there).
Gr.
Matthijs
Ævar Arnfjörð Bjarmason· Jan 6, 2011, 10:58 UTC · re: Pavan Savoy · lore

Re: git color in commit editor

On Thu, Jan 6, 2011 at 07:42, Pavan Savoy <pavan_savoy@sify.com> wrote:
> I have git version git version 1.5.6.3, on 1 system and get the colors
> right during a git commit (commit editor being vim..)

FWIW here's how to get those colors under Emacs: https://github.com/rafl/git-commit-mode

Pavan Savoy· Jan 9, 2011, 18:26 UTC · re: Ævar Arnfjörð Bjarmason · lore

Re: git color in commit editor

On Thu, Jan 6, 2011 at 4:28 PM, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:

Show 7 quoted lines
> On Thu, Jan 6, 2011 at 07:42, Pavan Savoy <pavan_savoy@sify.com> wrote:
>> I have git version git version 1.5.6.3, on 1 system and get the colors
>> right during a git commit (commit editor being vim..)
>
> FWIW here's how to get those colors under Emacs:
> https://github.com/rafl/git-commit-mode
>

Thanks, I do have syntax on in my vimrc, as I mentioned, I also have colors in vim for .c files on both machines... The only differences being git versions, also what syntax or color format would vim get for git and from where?

Jonathan Nieder· Jan 9, 2011, 18:33 UTC · re: Pavan Savoy · lore

Re: git color in commit editor

Pavan Savoy wrote:
> Thanks, I do have syntax on in my vimrc, as I mentioned, I also have colors in
> vim for .c files on both machines...
> The only differences being git versions, also what syntax or color
> format would vim get for git and from where?

$ find /usr/share/vim -name git\* /usr/share/vim/vim73/ftplugin/gitconfig.vim /usr/share/vim/vim73/ftplugin/gitsendemail.vim /usr/share/vim/vim73/ftplugin/gitrebase.vim /usr/share/vim/vim73/ftplugin/gitcommit.vim /usr/share/vim/vim73/ftplugin/git.vim /usr/share/vim/vim73/indent/gitconfig.vim /usr/share/vim/vim73/syntax/gitconfig.vim /usr/share/vim/vim73/syntax/gitsendemail.vim /usr/share/vim/vim73/syntax/gitrebase.vim /usr/share/vim/vim73/syntax/gitcommit.vim /usr/share/vim/vim73/syntax/git.vim

":help :syn-files" explains how to use them.

Hope that helps, Jonathan

← back to recent threads