tpope/vim-fugitive

Git log doesn't apply set colors

CRTejaswi opened this issue · 1 comments

I'm trying to git log using a custom format with colors:

:Git log --pretty=format:"%C(#ff0000)[%aN %as]: %C(#00ff00)%s"

While I get the colors when I issue the command with git at the terminal, I don't get any color when I run it using fugitive in Vim.

How may I fix this?

Fugitive loads the output into a Vim buffer, and Vim buffers don't support terminal escape sequences. The closest thing to what you are looking for is to use a terminal instead, which you can force by using a custom pager:

:Git -c pager.log=less log --pretty=format:"%C(#ff0000)[%aN %as]: %C(#00ff00)%s"

A lot of Fugitive functionality (e.g., jumping to a commit) only works in Vim buffers, so I don't recommend this.

Alternatively, you could customize the syntax highlighting in after/syntax/fugitive.vim. Your choice of punctuation should be very easy to match, in this particular case.