altercation / vim-colors-solarized

precision colorscheme for the vim text editor

Home Page:http://ethanschoonover.com/solarized

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

broken in neovim v0.10.0

cfebs opened this issue · comments

Setup / environment

Create a minimal vimrc.

❯ cat ~/.vimrc.solar 
call plug#begin('~/.vim/plugged')
Plug 'altercation/vim-colors-solarized'
call plug#end()

set t_Co=16
set background=dark
colorscheme solarized

Repro steps

Launch nvim with minimal vimrc

nvim -u ~/.vimrc.solar

Result

image

using same repro steps, swapping between default and solarized yields almost no difference.

vim_colo.mp4

Notes

nvim 0.10 made some changes to default colorscheme: https://neovim.io/doc/user/news-0.10.html#_-breaking-changes

TLDR: set notermguicolors for a workaround

Notes

with the minimal config from the setup above, i was just printing the values of the highlight groups that the theme tries to set:

:hi Normal                                                                             
Normal         xxx ctermfg=12 ctermbg=8 guifg=NvimLightGrey2 guibg=NvimDarkGrey2

:hi Comment                                                                            
Comment        xxx ctermfg=10 guifg=NvimLightGrey4

so did some research into guifg and guibg and found the termguicolors option.

'termguicolors' 'tgc'	boolean	(default off)
			global
	Enables 24-bit RGB color in the |TUI|.  Uses "gui" |:highlight|
	attributes instead of "cterm" attributes. |guifg|
	Requires an ISO-8613-3 compatible terminal.

	Nvim will automatically attempt to determine if the host terminal
	supports 24-bit color and will enable this option if it does
	(unless explicitly disabled by the user).

my value of:

:set termguicolors?

after startup is:

  termguicolors

so nvim is auto detecting 24-bit color support and enabling termguicolors by default.

set notermguicolors manually to disable this.

hope this helps anyone that ends up here via google 😸

Additional notes of 0.9.5 vs. 0.10.0

# 0.9.5
:hi String                                                                                   
String         xxx links to Constant

:hi Constant                                                                                 
Constant       xxx ctermfg=6 guifg=#ffa0a0 
# 0.10.0
:hi String                                                                                   
String         xxx ctermfg=10 guifg=NvimLightGreen

:hi Constant                                                                                 
Constant       xxx ctermfg=6 guifg=NvimLightGrey2

Just one affect of neovim's breaking changes.

For those looking to fork/fix with the advice from upstream summarized as:

We should fix the bundled colorschemes ... (e.g., by adding a colorscheme vim after the hi clear).

colorscheme can't be called from within another colorscheme

so something like this should work:

diff --git a/colors/solarized.vim b/colors/solarized.vim
index 70f5223..1b5d8e7 100644
--- a/colors/solarized.vim
+++ b/colors/solarized.vim
@@ -231,6 +231,11 @@ if exists("syntax_on")
 endif
 let colors_name = "solarized"
 
+if has('nvim')
+	"" @see https://github.com/neovim/neovim/issues/26378
+	runtime colors/vim.lua
+endif
+
 "}}}
 " GUI & CSApprox hexadecimal palettes"{{{
 " ---------------------------------------------------------------------

tried my hand at a simplified port as well: https://github.com/cfebs/solarized-16.vim