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

Orange Indentline highlight in coc-explorer #172

Closed
2 tasks done
leoatchina opened this issue Apr 20, 2023 · 13 comments
Closed
2 tasks done

Orange Indentline highlight in coc-explorer #172

leoatchina opened this issue Apr 20, 2023 · 13 comments
Labels
bug Something isn't working

Comments

@leoatchina
Copy link

leoatchina commented Apr 20, 2023

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

@leoatchina leoatchina added the bug Something isn't working label Apr 20, 2023
@antoineco
Copy link
Collaborator

antoineco commented Apr 20, 2023

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

@antoineco
Copy link
Collaborator

What does :verbose hi Conceal return?

@leoatchina
Copy link
Author

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

@antoineco
Copy link
Collaborator

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

@antoineco
Copy link
Collaborator

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

@leoatchina
Copy link
Author

leoatchina commented Apr 20, 2023

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

@antoineco
Copy link
Collaborator

antoineco commented Apr 20, 2023

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?

@leoatchina
Copy link
Author

leoatchina commented Apr 20, 2023

sublime
image

desert
image

edge
image

everforest
image

sonokai
image

gruvbox-material after I delete line 1493
image

@antoineco
Copy link
Collaborator

antoineco commented Apr 20, 2023

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'

@leoatchina
Copy link
Author

leoatchina commented Apr 20, 2023

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

@leoatchina
Copy link
Author

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

@antoineco
Copy link
Collaborator

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.

@leoatchina
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants