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

Example doesn't work (any more?) #14

Open
smurfix opened this issue Oct 5, 2023 · 5 comments
Open

Example doesn't work (any more?) #14

smurfix opened this issue Oct 5, 2023 · 5 comments

Comments

@smurfix
Copy link

smurfix commented Oct 5, 2023

Hello,

    vim.api.nvim_set_option("background", "dark")

These days this statement seems to not do a lot. set background still says dark after startup.

This works, at least on my NVIM 0.7.2 (Debian Stable) installation:

    vim.wo.background='dark'
@f-person
Copy link
Owner

f-person commented Oct 5, 2023

Hi!

In the code, we're now using vim.api.nvim_set_option_value("background", background, {}). I assume the API changed or something, I'll fix the example :)


BTW, you don't really have to define set_light_mode, or set_dark_mode. As long as your colorscheme is configured, just calling setup will work. My current config with catppuccin is:

require("auto-dark-mode").setup({ update_interval = 5000 })

@smurfix
Copy link
Author

smurfix commented Oct 5, 2023

As long as your colorscheme is configured, just calling setup will work

That's only true as long as you don't need/want to adjust anything else while you're at it. 😎

@f-person
Copy link
Owner

f-person commented Oct 5, 2023

That's true! :)
Thanks for the issue, l'll fix the docs soon!

@nekowinston
Copy link
Collaborator

What's curious is that I'm on nvim v0.9.2;
:lua vim.api.nvim_set_option("background", "dark") still works for me, and I don't see it marked as deprecated in the docs either.
Since window options are higher in priority than global options, perhaps a window option value is set in your case, so changing it in the global scope doesn't do anything.

@smurfix
Copy link
Author

smurfix commented Oct 6, 2023

That's certainly plausible, the question now is where that setting comes from. Testing shows that there's a "background=light" option set on my system even if I run nvim -u NONE (and it's not there when I start nvim with dark background). So apparently nvim does that by itself if you run it in an environment where it can figure that out.

In any case it seems prudent to ignore this mess and simply change the window's option.

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

3 participants