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

Setting vim.o.background breaks auto-detection #161

Open
realh opened this issue Jan 18, 2024 · 1 comment
Open

Setting vim.o.background breaks auto-detection #161

realh opened this issue Jan 18, 2024 · 1 comment

Comments

@realh
Copy link
Contributor

realh commented Jan 18, 2024

I'm using a config based on kickstart, which uses lazy.vim. It apparently loads the plugins before vim sets vim.o.background by reading it from the terminal. This means when the vscode plugin gets loaded it reads background's default value of 'dark', and by writing this back to vim.o.background it seems to disable vim's subsequent autodetection, so it always gets forced to 'dark' even if the terminal has a light background.

If I disable the line vim.o.background = ... in the plugin's init.lua, auto-detection works correctly. Please could you consider changing it? The code below seems to work for me, and should also work for anyone who relied on the old behavior.

    local background = style or config.opts.style
    if background and background ~= vim.o.background then
        vim.o.background = background
    end
realh added a commit to realh/vscode.nvim that referenced this issue Jan 20, 2024
@Mofiqul
Copy link
Owner

Mofiqul commented Jan 22, 2024

@realh - Can you make PR if you fixed the issue?

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

2 participants