-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathinit.lua
More file actions
34 lines (28 loc) · 792 Bytes
/
init.lua
File metadata and controls
34 lines (28 loc) · 792 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
require("rafe")
-- Add all your default functions here
print("Welcome")
local function set_background_based_on_os()
local handle = io.popen("~/dev/scripts/detect_appearance.sh")
if handle == nil then
print("Handle is NULL")
return
end
local result = handle:read("*a")
handle:close()
if result:match("true") then
print("Dark Mode detected")
vim.cmd("set background=dark")
else
print("Light Mode detected")
vim.cmd("set background=light")
end
end
-- Ensure this runs after all configurations, especially indent-blankline
vim.api.nvim_create_autocmd("VimEnter", {
pattern = "*",
callback = function()
vim.defer_fn(function()
set_background_based_on_os()
end, 0) -- Delay execution by 1ms to ensure all configs are loaded
end,
})