diff --git a/lua/lazyvim/config/init.lua b/lua/lazyvim/config/init.lua index be7b51f1..9fef3778 100644 --- a/lua/lazyvim/config/init.lua +++ b/lua/lazyvim/config/init.lua @@ -5,6 +5,12 @@ M.lazy_version = ">=9.1.0" ---@class LazyVimConfig local defaults = { + -- colorscheme can be a string like `catppuccin` or a function that will load the colorscheme + ---@type string|fun() + colorscheme = function() + require("tokyonight").load() + end, + -- icons used by other plugins icons = { diagnostics = { Error = " ", @@ -81,6 +87,20 @@ function M.setup(opts) M.load("keymaps") end, }) + + require("lazy.core.util").try(function() + if type(M.colorscheme) == "function" then + M.colorscheme() + else + vim.cmd.colorscheme(M.colorscheme) + end + end, { + msg = "Could not load your colorscheme", + on_error = function(msg) + require("lazy.core.util").error(msg) + vim.cmd.colorscheme("habamax") + end, + }) end ---@param range? string diff --git a/lua/lazyvim/plugins/colorscheme.lua b/lua/lazyvim/plugins/colorscheme.lua index d4f85234..3aadbe81 100644 --- a/lua/lazyvim/plugins/colorscheme.lua +++ b/lua/lazyvim/plugins/colorscheme.lua @@ -3,20 +3,12 @@ return { -- tokyonight { "folke/tokyonight.nvim", - lazy = false, - priority = 1000, opts = { style = "moon" }, - config = function(_, opts) - local tokyonight = require("tokyonight") - tokyonight.setup(opts) - tokyonight.load() - end, }, -- catppuccin { "catppuccin/nvim", name = "catppuccin", - priority = 1000, }, }