diff --git a/lua/cosmic/config/plugins.lua b/lua/cosmic/config/plugins.lua index 3195a06..c534e78 100644 --- a/lua/cosmic/config/plugins.lua +++ b/lua/cosmic/config/plugins.lua @@ -17,6 +17,7 @@ local plugins = { 'gitsigns', 'kommentary', 'statusline', + 'theme', -- if default theme is disabled, you will need to update add your own statusline 'treesitter', 'telescope', 'terminal', diff --git a/lua/cosmic/core/theme/colors.lua b/lua/cosmic/core/theme/colors.lua index 1f21d60..a3e8437 100644 --- a/lua/cosmic/core/theme/colors.lua +++ b/lua/cosmic/core/theme/colors.lua @@ -1,4 +1,9 @@ -local themeColors = require('tokyonight.colors').setup() +local ok, theme = pcall(require, 'tokyonight.colors') +if not ok then + return false +end + +local themeColors = theme.setup() local colors = { white = themeColors.fg_dark, diff --git a/lua/cosmic/core/theme/highlights.lua b/lua/cosmic/core/theme/highlights.lua index 430be1e..5fbeb89 100644 --- a/lua/cosmic/core/theme/highlights.lua +++ b/lua/cosmic/core/theme/highlights.lua @@ -1,4 +1,7 @@ -local colors = require('cosmic.core.theme.colors') +local _, colors = pcall(require, 'cosmic.core.theme.colors') +if not colors then + return +end local highlight = require('cosmic.utils').highlight -- diagnostic virtual text highlights diff --git a/lua/cosmic/core/theme/ui.lua b/lua/cosmic/core/theme/ui.lua index d7215ad..6a95609 100644 --- a/lua/cosmic/core/theme/ui.lua +++ b/lua/cosmic/core/theme/ui.lua @@ -5,7 +5,6 @@ local lsp = vim.lsp local buf, win function M.rename() - local colors = require('cosmic.core.theme.colors') local icons = require('cosmic.core.theme.icons') local utils = require('cosmic.utils') local config = require('cosmic.config') @@ -29,8 +28,12 @@ function M.rename() api.nvim_win_set_option(win, 'sidescrolloff', 0) api.nvim_buf_set_option(buf, 'modifiable', true) api.nvim_buf_set_option(buf, 'buftype', 'prompt') - api.nvim_buf_add_highlight(buf, -1, 'LspRenamePrompt', 0, 0, #prompt_str) - highlight('LspRenamePrompt', 'None', colors.selection_caret) + + local _, colors = pcall(require, 'cosmic.core.theme.colors') + if colors then + api.nvim_buf_add_highlight(buf, -1, 'LspRenamePrompt', 0, 0, #prompt_str) + highlight('LspRenamePrompt', 'None', colors.selection_caret) + end vim.fn.prompt_setprompt(buf, prompt_str) diff --git a/lua/cosmic/pluginsInit.lua b/lua/cosmic/pluginsInit.lua index b536724..bd5a07a 100644 --- a/lua/cosmic/pluginsInit.lua +++ b/lua/cosmic/pluginsInit.lua @@ -62,7 +62,7 @@ return packer.startup(function() vim.g.tokyonight_sidebars = { 'qf', 'packer' } vim.cmd('color tokyonight') end, - -- disable = vim.tbl_contains(user_plugins.disable, 'theme'), + disable = vim.tbl_contains(user_plugins.disable, 'theme'), }) use({ -- icons @@ -79,7 +79,7 @@ return packer.startup(function() require('cosmic.core.statusline') end, after = 'nvim-web-devicons', - disable = vim.tbl_contains(user_plugins.disable, 'statusline'), + disable = vim.tbl_contains(user_plugins.disable, 'statusline') or vim.tbl_contains(user_plugins.disable, 'theme'), }) -- file explorer