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

Guides not showing up the first time with colorscheme desert #109

Open
shikhanshu opened this issue Feb 25, 2016 · 6 comments
Open

Guides not showing up the first time with colorscheme desert #109

shikhanshu opened this issue Feb 25, 2016 · 6 comments

Comments

@shikhanshu
Copy link

Here's my .vimrc snippet:
let g:indent_guides_start_level=2
let g:indent_guides_guide_size=1
let g:indent_guides_enable_on_vim_startup=1
colorscheme desert
set background=dark

When I was on a different colorscheme (gruvbox), guides showed up just fine when opening up vim for the first time.

But now, with the desert colorscheme, the first time guides don't show up, but when I set background to dark again (even though it is already set to dark in vimrc) within vim, they show up.

What's happening?

@jerrylipeng
Copy link

I got the same issue.

I found that when vim starts, "let s:hi_normal = indent_guides#capture_highlight('Normal')" will get
Normal xxx guifg=gray guibg=grey17 font=Monospace 10
Then in indent_guides#gui_highlight_colors, "let l:color_name = matchstr(s:hi_normal, s:color_name_bg_pat)" will get "grey17 10".
So "let l:hi_normal_guibg = color_helper#color_name_to_hex(l:color_name)" gets an empty value.

if ":colorscheme desert", "indent_guides#capture_highlight('Normal')" returns "Normal xxx guifg=gray guibg=grey17", and the plugin works fine.

My workaround is:
change
let g:indent_guides_color_name_guibg_pattern = "guibg='?\zs[0-9A-Za-z ]+\ze'?"
to
let g:indent_guides_color_name_guibg_pattern = "guibg='?\zs[0-9A-Za-z]+\ze'?"
(Remove the space)

@shikhanshu
Copy link
Author

Any fix for this issue? I really like 'desert'. With other colorschemes (like molokai), indent guides show up right on cue as soon as I start vim with a file.

@jerrylipeng
Copy link

You can try my workaround. Works for me.

@haolly
Copy link

haolly commented Oct 31, 2016

same with you

@rahultadak
Copy link

Yes, this worked for me too.

@dragon-architect
Copy link

dragon-architect commented Dec 31, 2021

I've just had to resurrect my github account to comment that I am experiencing this exact same issue, but weirdly enough only in gVim. I'm using gVim 8.1, and the Desert colorscheme. I've already attempted jerrylipeng's workaround to no avail. I had to dig manually through the script files of this plugin to figure out which color it grabs from the color scheme and how it actually computes the highlight values to come up with this manual workaround that only applies to my version of the desert colorscheme:

First, :hi Normal returns a string that includes guibg=grey20, which is the color the script is supposed to grab (but it's also followed by the font info that jerrylipeng identifies as well).

Checking the color_helper.vim script indicates grey20 = #333333. From there, I manually applied the color_helper#hex_color_lighten(color, percent) function with a calculator to get the values needed for this code snippet now in my .vimrc:

if has("gui_running")
    if g:colors_name =~ "desert"
        autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd  guibg=#474747
        autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=#606060
    endif
endif

If jerrylipeng's workaround doesn't work for you, you may want to try this more manual fix until the plugin gets updated to fix this bug with the desert color scheme.

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

5 participants