sainnhe / gruvbox-material

Gruvbox with Material Palette

Home Page:https://www.vim.org/scripts/script.php?script_id=5814

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Orange Indentline highlight in coc-explorer

leoatchina opened this issue · comments

I have done the following steps before reporting this issue:

  • I have searched the existing issues
  • I have read the FAQ in the help doc

Operating system/version

windows but ssh to linux

Terminal emulator/version

All terminal I have used , include tabby , windows terminal, wezterm , mobaxterm

$TERM environment variable

not need

Tmux version

not need

Feature matrix

Open Coc-explore in vim/neovim, either sidebar or float

Minimal vimrc that can reproduce this bug.

not need , It happend when use colorscheme sonokai, edge, gruvbox-material, everest

image

After I changed colorscheme to nightfox
image

Steps to reproduce this bug using minimal vimrc

  1. install coc.nvim, and coc-explore, and opend coc-explorer
  2. In nvim 0.9, I do :inspect on the orange block
  3. got this
    image
  4. do verbose highlight CocExploreIndent
    4 got this
    image

Expected behavior

not orange indentline

Actual behavior

orange indentline

Thanks for the very detailed issue report! 🙌
Let me look into this.

What does :verbose hi Conceal return?

Conceal        xxx ctermfg=239 ctermbg=202 guifg=#5a524c guibg=#ff5f00                                                                                                                                                                                                      
        最近修改于 ~/.leovim.d/plug/coc.nvim/indentLine/after/plugin/indentLine.vim line 88       

There you go, Conceal was overwritten by indentLine.vim (#5a524c #ff5f00)

Are you using a theme in your terminal which might be overriding grey colors, such as base16-shell?

Actually , after I deleted line 1493 in gruvbox-mateial.vim, this bug disappeared
I donot installed base16-shell, but have tested lots of colorschemes, and I am sure this bug is only related with edge, sonokai, gruvbox-material, everest
image

indentline is forcing the background color to your terminal's color, so if you rewrote these to orange (like base16-shell does), they will show as orange in Vim too:

https://github.com/Yggdroot/indentLine/blob/d15d63bf9c4a74a02470d4bc8ecce53df13e3a75/after/plugin/indentLine.vim#L47-L53

What happens if you reload the colorscheme, for example with :colorscheme desert | colorscheme gruvbox-material?

sublime
image

desert
image

edge
image

everforest
image

sonokai
image

gruvbox-material after I delete line 1493
image

The reason why you don't see it in other colorschemes is because gruvbox-material (and all sainnhe's themes) doesn't force a background color, so indentline happily enforces its own color on top. This is a bad default from the plugin in my opinion.

call gruvbox_material#highlight('Conceal', s:palette.grey0, s:palette.none)

Try this:

" Apply custom highlights on colorscheme change.
" Must be declared before executing ':colorscheme'.
augroup custom_highlights_gruvboxmaterial
  autocmd!
  " reset indentline default
  autocmd ColorScheme gruvbox-material 
  \ hi! Conceal ctermbg=NONE guibg=NONE
augroup END

colorscheme gruvbox-material

or in Lua

-- Apply custom highlights on colorscheme change.
-- Must be declared before executing ':colorscheme'.
grpid = vim.api.nvim_create_augroup('custom_highlights_gruvboxmaterial', {})
vim.api.nvim_create_autocmd('ColorScheme', {
  group = grpid,
  pattern = 'gruvbox-material',
  command = -- reset indentline default
            'hi! Conceal ctermbg=NONE guibg=NONE'
})

vim.cmd'colorscheme gruvbox-material'

Should be like this

augroup Fix_CocExploererIndentline
    autocmd!
    autocmd ColorScheme gruvbox-material hi! CocExplorerIndentLine ctermbg=NONE guibg=NONE
    autocmd ColorScheme edge             hi! CocExplorerIndentLine ctermbg=NONE guibg=NONE
    autocmd ColorScheme sonokai          hi! CocExplorerIndentLine ctermbg=NONE guibg=NONE
    autocmd ColorScheme everforest       hi! CocExplorerIndentLine ctermbg=NONE guibg=NONE
augroup END

Also fixed vimLineComment bug

augroup Fix_CocColorScheme
    autocmd!
    autocmd ColorScheme edge,sonokai,everforest,gruvbox-material autocmd BufWinEnter * hi! vimLineComment ctermbg=NONE guibg=NONE
    autocmd ColorScheme edge,sonokai,everforest,gruvbox-material hi! CocExplorerIndentLine ctermbg=NONE guibg=NONE
augroup END

It would be better to fix the Conceal highlight group directly like I suggested.

The root cause of your issues is that indenline hijacks the Conceal group (which is a Vim core highlight group and shouldn't be overridden by plugins).
If you fix Conceal, you fix all issues at once.

Actually I have tried to fix Conceal group at first bu not work, so I tried CocExplorerIndentLine and it worked