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

Diff lines added/removed aren't green/red #36

Open
coldhawaiian opened this issue May 20, 2014 · 15 comments
Open

Diff lines added/removed aren't green/red #36

coldhawaiian opened this issue May 20, 2014 · 15 comments

Comments

@coldhawaiian
Copy link

I'm used to viewing diffs of files where added lines are green, and removed lines are red. This is the output of git diff:

screen shot 2014-05-19 at 8 22 02 pm

When viewing such diffs with the Molokai theme, added lines are orange, while removed lines are cyan. This is the output of vim temp.diff:

screen shot 2014-05-19 at 8 23 52 pm

I've been trying to mess around with the Molokai settings to get the output to look more like what I have for git diff, especially in regard to the green/red colors of added/removed lines. In particular, I tried setting the following to Red:

  • Line 43:
    • Original

      hi DiffDelete      guifg=#960050 guibg=#1E0010
    • Modified

      hi DiffDelete      guifg=Red guibg=#1E0010
  • Line 160:
    • Original

      hi DiffDelete      ctermfg=162 ctermbg=53
    • Modified

      hi DiffDelete      ctermfg=Red ctermbg=53

Unfortunately, the changes didn't seem to do anything. Is there anything I can do to change the diff colors to be what I want?

@Atcold
Copy link

Atcold commented Sep 23, 2015

I have the same problem. Red / green colour are a must. Has anyone figured this out already?

@justinmk
Copy link
Contributor

you must perform the :hi calls in a colorscheme autocmd, otherwise the colorscheme will overwrite your :hi settings. Here's what I use: https://github.com/justinmk/config/blob/master/.vimrc#L587-L607

@Atcold
Copy link

Atcold commented Sep 23, 2015

@justinmk, hmm... I've copied and pasted your snippet, but nothing really happens... 😥

@Atcold
Copy link

Atcold commented Sep 23, 2015

screenshot 2015-09-23 15 25 23

How can I debug this?
Can it also be incorporated into the main colour scheme, with a PR? I think it's a must!

@justinmk
Copy link
Contributor

You need to add the snippet to your vimrc and then restart vim...

@Atcold
Copy link

Atcold commented Sep 23, 2015

😐 that's what I did... The right file is my ~/.vimrc, and yes, I've relaunched Vim.

screenshot 2015-09-23 15 46 03

@justinmk
Copy link
Contributor

This is basic functionality. Ask on vi.stackexchange.com if you need help.

@Atcold
Copy link

Atcold commented Sep 27, 2015

@justinmk, you can try yourself. Make a ~/.vimrc with the code you pointed out and have the file ~/.vim/colors/molokai.vim. Try to see a diff and taa-daa, it does not work.
Here's my ~/.vimrc, you can source it with vim -u test_vimrc.

As you suggested, I've created a question on vi@stackexchange.

@Atcold
Copy link

Atcold commented Sep 27, 2015

@coldhawaiian, here is the solution. Put these lines in your ~/.vimrc

colorscheme molokai
" Better gitcommit messages
hi diffAdded   ctermbg=NONE ctermfg=46  cterm=NONE guibg=NONE guifg=#00FF00 gui=NONE
hi diffRemoved ctermbg=NONE ctermfg=196 cterm=NONE guibg=NONE guifg=#FF0000 gui=NONE
hi link diffLine String
hi link diffSubname Normal

And here a before / after 😬

before-after

@justinmk
Copy link
Contributor

My mistake. Molokai should not use those colors though.

@Atcold
Copy link

Atcold commented Sep 27, 2015

@justinmk, to which colours are you referring?
Moreover, in the solution I've suggested there is no need of the autocmd and it looks more simple. Or this won't work in some specific conditions for which you've chosen to use the autocmd?

@justinmk
Copy link
Contributor

I'm saying molokai should not change its colors. Removing personality defeats the purpose of a colorscheme.

@Atcold
Copy link

Atcold commented Sep 27, 2015

@justinmk, if you use git then vim has to show git's diff colours, whatever colour scheme you have.
Having the light blue and orange for removal and addition are completely deceiving, at least personally speaking. And I believe I'm not the only one of this opinion. But then, taste is subjective.

@justinmk
Copy link
Contributor

git config color.diff.old, git config color.diff.new, may be configured to have any color. It might be an interesting feature for the Vim ftplugin for git to detect that configuration and set colors in a ft=git buffer, optionally. It's not the realm of a colorscheme though.

@liitii
Copy link

liitii commented Jul 21, 2016

Thanks, @Atcold. This was enough for me:

colo molokai
hi diffAdded ctermfg=46  cterm=NONE guifg=#2BFF2B gui=NONE
hi diffRemoved ctermfg=196 cterm=NONE guifg=#FF2B2B gui=NONE

(A little lighter than pure red/green fits better with the theme IMHO.)

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

4 participants