diff --git a/lua/config/preconfig.lua b/lua/config/preconfig.lua new file mode 100755 index 0000000..c99687d --- /dev/null +++ b/lua/config/preconfig.lua @@ -0,0 +1,27 @@ +-- Disable netrw before anything else loads +vim.g.loaded_netrw = 1 +vim.g.loaded_netrwPlugin = 1 +vim.g.loaded_netrwSettings = 1 +vim.g.loaded_netrwFileHandlers = 1 + +-- Apply transparent background after any colorscheme change +vim.api.nvim_create_autocmd('ColorScheme', { + pattern = '*', + callback = function() + vim.api.nvim_set_hl(0, 'Normal', { bg = 'none' }) + vim.api.nvim_set_hl(0, 'NormalNC', { bg = 'none' }) + end, +}) + +local themes = require('custom.themes') +-- Set correct colorscheme before plugins load (prevents flash) +local is_dark = vim.trim(vim.fn.system('defaults read -g AppleInterfaceStyle 2>/dev/null')) == 'Dark' +vim.o.background = is_dark and 'dark' or 'light' + +local ok, _ = pcall(function() + vim.cmd.colorscheme(is_dark and themes.dark or themes.light) +end) + +if not ok then + vim.cmd.colorscheme('habamax') +end diff --git a/lua/custom/themes.lua b/lua/custom/themes.lua new file mode 100644 index 0000000..29c1b3d --- /dev/null +++ b/lua/custom/themes.lua @@ -0,0 +1,4 @@ +return { + dark = 'monokai_soda', + light = 'solarized', +}