From f191627cbfcdf481fc17c4422e4513a410a845fa Mon Sep 17 00:00:00 2001 From: srdusr Date: Wed, 28 Jun 2023 23:53:07 +0200 Subject: Made colorscheme fallback --- lua/plugins/colorscheme.lua | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lua/plugins/colorscheme.lua b/lua/plugins/colorscheme.lua index 10f0432..14edbdf 100644 --- a/lua/plugins/colorscheme.lua +++ b/lua/plugins/colorscheme.lua @@ -1,11 +1,17 @@ -- Colorscheme -- Available colorschemes: -- [[ nightfly ayu onedark doom-one nvimgelion github_dark tokyonight ]] -local colorscheme = "tokyonight-night" -local status_ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme) + +-- Define default color scheme +local default_colorscheme = "tokyonight-night" +local fallback_colorscheme = "desert" + +-- Attempt to set the default color scheme +local status_ok, _ = pcall(vim.cmd, "colorscheme " .. default_colorscheme) + +-- If the default color scheme is not found, use the fallback color scheme if not status_ok then - vim.notify("colorscheme " .. colorscheme .. " not found!") - return + vim.cmd("colorscheme " .. fallback_colorscheme) end --local function MyHighlights() @@ -26,7 +32,7 @@ end vim.api.nvim_command("syntax on") -vim.api.nvim_command("highlight Normal guibg=none") +vim.api.nvim_command("highlight Normal guibg=NONE") vim.api.nvim_command("highlight NormalNC guibg=none") vim.api.nvim_command("highlight SignColumn guibg=none") --vim.api.nvim_command("highlight FoldColumn guibg=none") -- cgit v1.2.3