tomasr / molokai

Molokai color scheme for Vim
Other
3.61k stars 1.69k forks source link

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

Open coldhawaiian opened 10 years ago

coldhawaiian commented 10 years ago

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:

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 commented 9 years ago

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

justinmk commented 9 years ago

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 commented 9 years ago

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

Atcold commented 9 years ago
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 commented 9 years ago

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

Atcold commented 9 years ago

:neutral_face: 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 commented 9 years ago

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

Atcold commented 9 years ago

@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 commented 9 years ago

@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 :grimacing:

before-after
justinmk commented 9 years ago

My mistake. Molokai should not use those colors though.

Atcold commented 9 years ago

@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 commented 9 years ago

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

Atcold commented 9 years ago

@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 commented 9 years ago

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 commented 8 years ago

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.)