diff --git a/config/nvim/lua/plugins/all-themes.lua b/config/nvim/lua/plugins/all-themes.lua new file mode 100644 index 00000000..c17001a3 --- /dev/null +++ b/config/nvim/lua/plugins/all-themes.lua @@ -0,0 +1,56 @@ +return { + -- Load all theme plugins but don't apply them + -- This ensures all colorschemes are available for hot-reloading + { + "ribru17/bamboo.nvim", + lazy = true, + priority = 1000, + }, + { + "catppuccin/nvim", + name = "catppuccin", + lazy = true, + priority = 1000, + }, + { + "sainnhe/everforest", + lazy = true, + priority = 1000, + }, + { + "ellisonleao/gruvbox.nvim", + lazy = true, + priority = 1000, + }, + { + "rebelot/kanagawa.nvim", + lazy = true, + priority = 1000, + }, + { + "tahayvr/matteblack.nvim", + lazy = true, + priority = 1000, + }, + { + "loctvl842/monokai-pro.nvim", + lazy = true, + priority = 1000, + }, + { + "shaunsingh/nord.nvim", + lazy = true, + priority = 1000, + }, + { + "rose-pine/neovim", + name = "rose-pine", + lazy = true, + priority = 1000, + }, + { + "folke/tokyonight.nvim", + lazy = true, + priority = 1000, + }, +} diff --git a/config/nvim/lua/plugins/omarchy-theme-hotreload.lua b/config/nvim/lua/plugins/omarchy-theme-hotreload.lua new file mode 100644 index 00000000..8d05a5b8 --- /dev/null +++ b/config/nvim/lua/plugins/omarchy-theme-hotreload.lua @@ -0,0 +1,45 @@ +return { + { + name = "theme-hotreload", + dir = vim.fn.stdpath("config"), + lazy = false, + priority = 1000, + config = function() + local transparency_file = vim.fn.stdpath("config") .. "/plugin/after/transparency.lua" + + vim.api.nvim_create_autocmd("User", { + pattern = "LazyReload", + callback = function() + package.loaded["plugins.theme"] = nil + + vim.schedule(function() + local ok, theme_spec = pcall(require, "plugins.theme") + if not ok then + return + end + + for _, spec in ipairs(theme_spec) do + if spec[1] == "LazyVim/LazyVim" and spec.opts and spec.opts.colorscheme then + local colorscheme = spec.opts.colorscheme + + require("lazy.core.loader").colorscheme(colorscheme) + + vim.defer_fn(function() + pcall(vim.cmd.colorscheme, colorscheme) + + if vim.fn.filereadable(transparency_file) == 1 then + vim.defer_fn(function() + vim.cmd.source(transparency_file) + end, 5) + end + end, 5) + + break + end + end + end) + end, + }) + end, + }, +} diff --git a/config/nvim/lua/plugins/theme.lua b/config/nvim/lua/plugins/theme.lua deleted file mode 100644 index dad2d30b..00000000 --- a/config/nvim/lua/plugins/theme.lua +++ /dev/null @@ -1,8 +0,0 @@ -return { - { - "LazyVim/LazyVim", - opts = { - colorscheme = "tokyonight", - }, - }, -} diff --git a/migrations/1758081785.sh b/migrations/1758081785.sh new file mode 100644 index 00000000..40e062a9 --- /dev/null +++ b/migrations/1758081785.sh @@ -0,0 +1,4 @@ +echo "Add live themeing to neovim" + +cp -f $OMARCHY_PATH/config/nvim/lua/plugins/all-themes.lua ~/.config/nvim/lua/plugins/ +cp -f $OMARCHY_PATH/config/nvim/lua/plugins/omarchy-theme-hotreload.lua ~/.config/nvim/lua/plugins/ diff --git a/themes/catppuccin-latte/neovim.lua b/themes/catppuccin-latte/neovim.lua index 07a53cf8..53eaf45c 100644 --- a/themes/catppuccin-latte/neovim.lua +++ b/themes/catppuccin-latte/neovim.lua @@ -3,12 +3,9 @@ return { "catppuccin/nvim", name = "catppuccin", priority = 1000, - config = function() - require("catppuccin").setup({ - flavour = "latte", -- other options: "mocha", "frappe", "macchiato" - }) - vim.cmd.colorscheme("catppuccin-latte") - end, + opts = { + flavour = "latte", + }, }, { "LazyVim/LazyVim", diff --git a/themes/catppuccin/neovim.lua b/themes/catppuccin/neovim.lua index dbe34f5e..a8683876 100644 --- a/themes/catppuccin/neovim.lua +++ b/themes/catppuccin/neovim.lua @@ -1,4 +1,9 @@ return { + { + "catppuccin/nvim", + name = "catppuccin", + priority = 1000, + }, { "LazyVim/LazyVim", opts = { diff --git a/themes/osaka-jade/neovim.lua b/themes/osaka-jade/neovim.lua index b2bd3f20..b3c9edc5 100644 --- a/themes/osaka-jade/neovim.lua +++ b/themes/osaka-jade/neovim.lua @@ -1,9 +1,13 @@ return { - "ribru17/bamboo.nvim", - lazy = false, - priority = 1000, - config = function() - require("bamboo").setup({}) - require("bamboo").load() - end, + { + "ribru17/bamboo.nvim", + priority = 1000, + opts = {}, + }, + { + "LazyVim/LazyVim", + opts = { + colorscheme = "bamboo", + }, + }, } diff --git a/themes/ristretto/neovim.lua b/themes/ristretto/neovim.lua index 38959d47..d862d161 100644 --- a/themes/ristretto/neovim.lua +++ b/themes/ristretto/neovim.lua @@ -1,31 +1,14 @@ return { - { - "gthelding/monokai-pro.nvim", - config = function() - require("monokai-pro").setup({ - filter = "ristretto", - override = function() - return { - NonText = { fg = "#948a8b" }, - MiniIconsGrey = { fg = "#948a8b" }, - MiniIconsRed = { fg = "#fd6883" }, - MiniIconsBlue = { fg = "#85dacc" }, - MiniIconsGreen = { fg = "#adda78" }, - MiniIconsYellow = { fg = "#f9cc6c" }, - MiniIconsOrange = { fg = "#f38d70" }, - MiniIconsPurple = { fg = "#a8a9eb" }, - MiniIconsAzure = { fg = "#a8a9eb" }, - MiniIconsCyan = { fg = "#85dacc" }, -- same value as MiniIconsBlue for consistency - } - end, - }) - vim.cmd([[colorscheme monokai-pro]]) - end, - }, - { - "LazyVim/LazyVim", - opts = { - colorscheme = "monokai-pro", - }, - }, + { + "loctvl842/monokai-pro.nvim", + opts = { + filter = "ristretto", + }, + }, + { + "LazyVim/LazyVim", + opts = { + colorscheme = "monokai-pro", + }, + }, } diff --git a/themes/tokyo-night/neovim.lua b/themes/tokyo-night/neovim.lua index dad2d30b..39327c9b 100644 --- a/themes/tokyo-night/neovim.lua +++ b/themes/tokyo-night/neovim.lua @@ -1,8 +1,12 @@ return { + { + "folke/tokyonight.nvim", + priority = 1000, + }, { "LazyVim/LazyVim", opts = { - colorscheme = "tokyonight", + colorscheme = "tokyonight-night", }, }, }