diff --git a/lua/colorschemes.lua b/lua/colorschemes.lua index 57fc22d..9618b4d 100644 --- a/lua/colorschemes.lua +++ b/lua/colorschemes.lua @@ -6,112 +6,63 @@ local M = {} -- Colorscheme to its directory name mapping, because colorscheme repo name is not necessarily -- the same as the colorscheme name itself. -M.colorscheme2dir = { - onedark = "onedark.nvim", - edge = "edge", - sonokai = "sonokai", - gruvbox_material = "gruvbox-material", - nord = "nord.nvim", - everforest = "everforest", - nightfox = "nightfox.nvim", - kanagawa = "kanagawa.nvim", - catppuccin = "catppuccin", - onedarkpro = "onedarkpro.nvim", - monokai = "monokai.nvim", - material = "material.nvim", +M.colorscheme_conf = { + onedark = function() + vim.cmd([[colorscheme onedark]]) + end, + edge = function() + vim.g.edge_enable_italic = 1 + vim.g.edge_better_performance = 1 + + vim.cmd([[colorscheme edge]]) + end, + sonokai = function() + vim.g.sonokai_enable_italic = 1 + vim.g.sonokai_better_performance = 1 + + vim.cmd([[colorscheme sonokai]]) + end, + gruvbox_material = function() + -- foreground option can be material, mix, or original + vim.g.gruvbox_material_foreground = "material" + --background option can be hard, medium, soft + vim.g.gruvbox_material_background = "soft" + vim.g.gruvbox_material_enable_italic = 1 + vim.g.gruvbox_material_better_performance = 1 + + vim.cmd([[colorscheme gruvbox-material]]) + end, + everforest = function() + vim.g.everforest_enable_italic = 1 + vim.g.everforest_better_performance = 1 + + vim.cmd([[colorscheme everforest]]) + end, + nightfox = function() + vim.cmd([[colorscheme nordfox]]) + end, + catppuccin = function() + -- available option: latte, frappe, macchiato, mocha + vim.g.catppuccin_flavour = "frappe" + require("catppuccin").setup() + + vim.cmd([[colorscheme catppuccin]]) + end, + onedarkpro = function() + -- set colorscheme after options + vim.cmd('colorscheme onedark_vivid') + end, + material = function() + vim.g.material_style = "oceanic" + vim.cmd('colorscheme material') + end, } -M.gruvbox8 = function() - -- Italic options should be put before colorscheme setting, - -- see https://github.com/morhetz/gruvbox/wiki/Terminal-specific#1-italics-is-disabled - vim.g.gruvbox_italics = 1 - vim.g.gruvbox_italicize_strings = 1 - vim.g.gruvbox_filetype_hi_groups = 1 - vim.g.gruvbox_plugin_hi_groups = 1 - - vim.cmd([[colorscheme gruvbox8_hard]]) -end - -M.onedark = function() - vim.cmd([[colorscheme onedark]]) -end - -M.edge = function() - vim.g.edge_enable_italic = 1 - vim.g.edge_better_performance = 1 - - vim.cmd([[colorscheme edge]]) -end - -M.sonokai = function() - vim.g.sonokai_enable_italic = 1 - vim.g.sonokai_better_performance = 1 - - vim.cmd([[colorscheme sonokai]]) -end - -M.gruvbox_material = function() - -- foreground option can be material, mix, or original - vim.g.gruvbox_material_foreground = "material" - --background option can be hard, medium, soft - vim.g.gruvbox_material_background = "soft" - vim.g.gruvbox_material_enable_italic = 1 - vim.g.gruvbox_material_better_performance = 1 - - vim.cmd([[colorscheme gruvbox-material]]) -end - -M.nord = function() - vim.cmd([[colorscheme nord]]) -end - -M.doom_one = function() - vim.cmd([[colorscheme doom-one]]) -end - -M.everforest = function() - vim.g.everforest_enable_italic = 1 - vim.g.everforest_better_performance = 1 - - vim.cmd([[colorscheme everforest]]) -end - -M.nightfox = function() - vim.cmd([[colorscheme nordfox]]) -end - -M.kanagawa = function() - vim.cmd([[colorscheme kanagawa]]) -end - -M.catppuccin = function() - -- available option: latte, frappe, macchiato, mocha - vim.g.catppuccin_flavour = "frappe" - - require("catppuccin").setup() - - vim.cmd([[colorscheme catppuccin]]) -end - -M.onedarkpro = function() - -- set colorscheme after options - vim.cmd('colorscheme onedark_vivid') -end - -M.monokai = function() - vim.cmd('colorscheme monokai_pro') -end - -M.material = function () - vim.g.material_style = "oceanic" - vim.cmd('colorscheme material') -end - --- Use a random colorscheme from the pre-defined list of colorschemes. M.rand_colorscheme = function() - local colorscheme = utils.rand_element(vim.tbl_keys(M.colorscheme2dir)) + local colorscheme = utils.rand_element(vim.tbl_keys(M.colorscheme_conf)) - if not vim.tbl_contains(vim.tbl_keys(M), colorscheme) then + if not vim.tbl_contains(vim.tbl_keys(M.colorscheme_conf), colorscheme) then local msg = "Invalid colorscheme: " .. colorscheme vim.notify(msg, vim.log.levels.ERROR, { title = "nvim-config" }) @@ -119,7 +70,7 @@ M.rand_colorscheme = function() end -- Load the colorscheme and its settings - M[colorscheme]() + M.colorscheme_conf[colorscheme]() if vim.g.logging_level == "debug" then local msg = "Colorscheme: " .. colorscheme diff --git a/lua/plugin_specs.lua b/lua/plugin_specs.lua index 8f9c4be..55d6f89 100644 --- a/lua/plugin_specs.lua +++ b/lua/plugin_specs.lua @@ -127,13 +127,10 @@ local plugin_specs = { { "sainnhe/edge", lazy = true }, { "sainnhe/sonokai", lazy = true }, { "sainnhe/gruvbox-material", lazy = true }, - { "shaunsingh/nord.nvim", lazy = true }, { "sainnhe/everforest", lazy = true }, { "EdenEast/nightfox.nvim", lazy = true }, - { "rebelot/kanagawa.nvim", lazy = true }, { "catppuccin/nvim", name = "catppuccin", lazy = true }, { "olimorris/onedarkpro.nvim", lazy = true }, - { "tanvirtin/monokai.nvim", lazy = true }, { "marko-cerovac/material.nvim", lazy = true }, { "nvim-tree/nvim-web-devicons", event = "VeryLazy" },