f-person/auto-dark-mode.nvim

Breaks on using nvim with sudo

KritPaoIn opened this issue · 3 comments

Screen.Recording.2022-09-14.at.6.13.13.PM.mov

Code:

local auto_dark_mode = require("auto-dark-mode")
auto_dark_mode.setup({
update_interval = 4000,
set_light_mode = function()
	theme.light_theme()
        vim.cmd(hls)
end,
set_dark_mode = function()
	theme.dark_theme()
        vim.cmd(hls)
end,
})
auto_dark_mode.init()

Hi! I'm sorry for not getting back to you sooner. The plugin checks the OS mode by reading UserDefaults:

defaults read -g AppleInterfaceStyle

I guess these are different for your user and root; that's why this happens. Not sure what we can do here

BTW, it works correctly if you run sudo while also providing your current user name. So, for KritPaoIn it would be

sudo -u KritPaoIn nvim

Alright, the plugin will now handle sudo :)