From 4f0271b5880ad47ee5b02b4fa5307b7f9191c7e7 Mon Sep 17 00:00:00 2001 From: Pratik Karki Date: Thu, 3 Jul 2025 12:28:47 +0545 Subject: [PATCH] Be able to switch to current theme Additionally, check if the current theme is accessible and loadable else, fallback to a default theme as to not break the theme. Signed-off-by: Pratik Karki --- config/nvim/lua/plugins/theme.lua | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/config/nvim/lua/plugins/theme.lua b/config/nvim/lua/plugins/theme.lua index dad2d30..8464386 100644 --- a/config/nvim/lua/plugins/theme.lua +++ b/config/nvim/lua/plugins/theme.lua @@ -1,4 +1,8 @@ -return { +local uv = vim.uv +local file_path = vim.fn.expand("~/.config/omarchy/current/theme/neovim.lua") + +-- Default configuration +local default = { { "LazyVim/LazyVim", opts = { @@ -6,3 +10,13 @@ return { }, }, } + +-- Try to load custom theme, fallback to default +if uv.fs_stat(file_path) then + local success, result = pcall(dofile, file_path) + if success and type(result) == "table" then + return result + end +end + +return default