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

Affecting other colorschemes #7

Closed
ghost opened this issue Dec 6, 2016 · 4 comments
Closed

Affecting other colorschemes #7

ghost opened this issue Dec 6, 2016 · 4 comments

Comments

@ghost
Copy link

ghost commented Dec 6, 2016

I am using NVIM v0.2.0-45-g7666b49 inside tmux 2.3 in gnome-terminal on Debian Jessie, all of which are properly setup to display true color. I am using three 24 bit colorschemes and want to be able to switch between them:

However, as soon as I use the NeoSolarized colorscheme once - whether I set it in my init.vim or via :colorscheme NeoSolarized makes no difference - the other two colorschemes no longer look as they did before when I reactivate them with :colo tender or :colo onedark. Some words that used to be highlighted with color before are no longer highlighted with a color. This happens only when I use the NeoSolarized colorscheme - between the other two I can switch without any problems.

Steps to reproduce:

  1. Create this init.vim and download the three truecolor colorschemes with vim-plug:
call plug#begin()
" three 24bit/truecolor colorschemes used for this example
Plug 'jacoborus/tender'
Plug 'joshdick/onedark.vim'
Plug 'iCyMind/NeoSolarized'
call plug#end()
set termguicolors
set background=dark
colorscheme tender
  1. Open init.vim in nvim. Notice that the words call, set and colorscheme in init.vim are all colored.
    (2.1 Run :colo onedark. They are still all colored.)
    (2.2 Run :colo tender. Still colored.)
  2. Run :colo NeoSolarized. They are still colored.
  3. Run either :colo tender or :colo onedark. The words call, set and colorscheme in init.vim are no longer colored.

Alternative way to reproduce:
Take the init.vim given above an replace the last line (colorscheme tender) with colorscheme NeoSolarized. Run :colo tender or :colo onedark. The words call, set and colorscheme in init.vim are no longer colored.

@overcache
Copy link
Owner

overcache commented Dec 6, 2016

Hi, cbaumhardt, thanks for help.

Check for more infomation about this bug at altercation/solarized#102

If you change your colorscheme frequently, the vim-colorscheme-switcher plugin is highly recommended to avoid this issue.

@ghost
Copy link
Author

ghost commented Dec 6, 2016

Thanks for your quick answer. The interesting thing to me is that this bug seems to just happen with the solarized/NeoSolarized colorscheme. The problem does not happen if I use other true color schemes like tender or onedark. I wonder if this issue could simple be fixed by changing colors/NeoSolarized.vim to be more like colors/tender.vim. It seems logical to me that this would fix the issue.

@overcache
Copy link
Owner

overcache commented Dec 6, 2016

Words like set and colorscheme in init.vim are identify as 'vimCommand' by $NVIMRUNTIME/syntax/vim.vim.

And words in group 'vimCommand' are highlighted same color as 'Statement' by hi def link vimCommand Statement.

Solarized specify a color(yellow) for the 'vimCommand' group, so their color are different with 'Statement' group.

Onedark or tender doesn't specify color for 'vimCommand' group, words in 'vimCommand' highlight group will render as nohighlight when you switch from solarized/NeoSolarized to onedark/tender/other-colorscheme.

As tpope said at altercation/solarized#102

From syntax/vim.vim:
hi def link vimCommand Statement
That means "unless vimCommand is already defined, link it to Statement" (see :help :hi-default). Solarized declares it to be yellow. When you switch away from Solarized, Vim resets all the highlighting. But when syntax/vim.vim is reapplied, vimCommand is already "tainted", so the highlight default no longer applies. Ergo, it's left cleared.
At least, that's my best understanding of it. Clearly it's an incomplete explanation as other groups appear fine.

Yes, this issue can fixed simply, just delete lines in vim syntax highlighting section in colors/NeoSolarized file. But it will lose color and I won't do that.

@ghost
Copy link
Author

ghost commented Dec 6, 2016

Thanks for clarification, I misunderstood something the first time I read the linked post. I am now using xolox/vim-colorscheme-switcher as you suggested and no longer experience any problems with NeoSolarized.

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

1 participant