Mofiqul / vscode.nvim

Neovim/Vim color scheme inspired by Dark+ and Light+ theme in Visual Studio Code
MIT License
692 stars 111 forks source link

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

Open realh opened 7 months ago

realh commented 7 months ago

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
Mofiqul commented 7 months ago

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