Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git log doesn't apply set colors #2304

Closed
CRTejaswi opened this issue May 15, 2024 · 1 comment
Closed

Git log doesn't apply set colors #2304

CRTejaswi opened this issue May 15, 2024 · 1 comment

Comments

@CRTejaswi
Copy link

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?

@tpope
Copy link
Owner

tpope commented May 17, 2024

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.

@tpope tpope closed this as completed May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants