mirror of
https://github.com/basecamp/omarchy.git
synced 2025-07-27 12:19:24 +00:00
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 <pratik@prertik.com>
This commit is contained in:
@ -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",
|
"LazyVim/LazyVim",
|
||||||
opts = {
|
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
|
||||||
|
Reference in New Issue
Block a user