Yggdroot / indentLine

A vim plugin to display the indention levels with thin vertical lines
MIT License
4.13k stars 227 forks source link

BUG: Does not work with a transparent background color but I think I figured out why #370

Open leftbones opened 2 years ago

leftbones commented 2 years ago

After installing I wasn't able to get the lines to show up by setting

let g:indentLine_defaultGroup = 'Comment'
let g:indentLine_char = '|'

in my .vimrc

I'm on a Mac, but I verified with grep that my installation of vim (brew) has conceal, and running hi conceal outputs Conceal xxx ctermfg=59 guifg=#5C6370

I use a custom color scheme, so I decided to try onedark since it's well supported, and suddenly the lines appeared again. Then, after applying the code to make the background color transparent for onedark, the lines disappeared again.

This is the code supplied on the onedark repo, added before colorscheme in my .vimrc

" onedark.vim override: Don't set a background color when running in a terminal;
" just use the terminal's background color
" `gui` is the hex color code used in GUI mode/nvim true-color mode
" `cterm` is the color code used in 256-color mode
" `cterm16` is the color code used in 16-color mode
if (has("autocmd") && !has("gui_running"))
  augroup colorset
    autocmd!
    let s:white = { "gui": "#ABB2BF", "cterm": "145", "cterm16" : "7" }
    autocmd ColorScheme * call onedark#set_highlight("Normal", { "fg": s:white }) " `bg` will not be styled since there is no `bg` setting
  augroup END
endif
leftbones commented 2 years ago

Changed the title because now I'm less sure about my findings being the reason why it doesn't work lol

I removed that line code block for making the background transparent and now the lines are no longer showing again, I'm really not sure what caused them to disappear again.

While screwing around with the settings on the README I was able to get it to appear once but then it stopped working again and I now can't remember what I did to make it happen, so I'm retracing my steps.

leftbones commented 2 years ago

Okay, new update. I don't know what I did to get it to reappear the previous times, BUT... I did decide to look at the rest of my .vimrc and I had this little guy here match Comment '^\s\+' which I think was just a leftover from when I was using tabs instead of spaces and making indent lines with set list lcs=tab:\|\ that never got removed. Removing that line makes the indent lines reappear again, in both Python and C files, the only ones I was testing.

leftbones commented 2 years ago

Also confirmed that re-adding the onedark snippet I mentioned earlier (for a transparent background) still shows the indent lines in the expected color.