1
0
mirror of https://github.com/jdhao/nvim-config.git synced 2025-06-08 14:14:33 +02:00

Update colorscheme conf

1. remove some colorscheme that doesn't work well with Markdown
2. change how the colorscheme conf is organized.
This commit is contained in:
jdhao 2024-02-01 20:37:27 +01:00
parent 8416508686
commit 7cf70f31af
2 changed files with 53 additions and 105 deletions

View File

@ -6,51 +6,23 @@ local M = {}
-- Colorscheme to its directory name mapping, because colorscheme repo name is not necessarily -- Colorscheme to its directory name mapping, because colorscheme repo name is not necessarily
-- the same as the colorscheme name itself. -- the same as the colorscheme name itself.
M.colorscheme2dir = { M.colorscheme_conf = {
onedark = "onedark.nvim", onedark = function()
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.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]]) vim.cmd([[colorscheme onedark]])
end end,
edge = function()
M.edge = function()
vim.g.edge_enable_italic = 1 vim.g.edge_enable_italic = 1
vim.g.edge_better_performance = 1 vim.g.edge_better_performance = 1
vim.cmd([[colorscheme edge]]) vim.cmd([[colorscheme edge]])
end end,
sonokai = function()
M.sonokai = function()
vim.g.sonokai_enable_italic = 1 vim.g.sonokai_enable_italic = 1
vim.g.sonokai_better_performance = 1 vim.g.sonokai_better_performance = 1
vim.cmd([[colorscheme sonokai]]) vim.cmd([[colorscheme sonokai]])
end end,
gruvbox_material = function()
M.gruvbox_material = function()
-- foreground option can be material, mix, or original -- foreground option can be material, mix, or original
vim.g.gruvbox_material_foreground = "material" vim.g.gruvbox_material_foreground = "material"
--background option can be hard, medium, soft --background option can be hard, medium, soft
@ -59,59 +31,38 @@ M.gruvbox_material = function()
vim.g.gruvbox_material_better_performance = 1 vim.g.gruvbox_material_better_performance = 1
vim.cmd([[colorscheme gruvbox-material]]) vim.cmd([[colorscheme gruvbox-material]])
end end,
everforest = function()
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_enable_italic = 1
vim.g.everforest_better_performance = 1 vim.g.everforest_better_performance = 1
vim.cmd([[colorscheme everforest]]) vim.cmd([[colorscheme everforest]])
end end,
nightfox = function()
M.nightfox = function()
vim.cmd([[colorscheme nordfox]]) vim.cmd([[colorscheme nordfox]])
end end,
catppuccin = function()
M.kanagawa = function()
vim.cmd([[colorscheme kanagawa]])
end
M.catppuccin = function()
-- available option: latte, frappe, macchiato, mocha -- available option: latte, frappe, macchiato, mocha
vim.g.catppuccin_flavour = "frappe" vim.g.catppuccin_flavour = "frappe"
require("catppuccin").setup() require("catppuccin").setup()
vim.cmd([[colorscheme catppuccin]]) vim.cmd([[colorscheme catppuccin]])
end end,
onedarkpro = function()
M.onedarkpro = function()
-- set colorscheme after options -- set colorscheme after options
vim.cmd('colorscheme onedark_vivid') vim.cmd('colorscheme onedark_vivid')
end end,
material = function()
M.monokai = function()
vim.cmd('colorscheme monokai_pro')
end
M.material = function ()
vim.g.material_style = "oceanic" vim.g.material_style = "oceanic"
vim.cmd('colorscheme material') vim.cmd('colorscheme material')
end end,
}
--- Use a random colorscheme from the pre-defined list of colorschemes. --- Use a random colorscheme from the pre-defined list of colorschemes.
M.rand_colorscheme = function() 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 local msg = "Invalid colorscheme: " .. colorscheme
vim.notify(msg, vim.log.levels.ERROR, { title = "nvim-config" }) vim.notify(msg, vim.log.levels.ERROR, { title = "nvim-config" })
@ -119,7 +70,7 @@ M.rand_colorscheme = function()
end end
-- Load the colorscheme and its settings -- Load the colorscheme and its settings
M[colorscheme]() M.colorscheme_conf[colorscheme]()
if vim.g.logging_level == "debug" then if vim.g.logging_level == "debug" then
local msg = "Colorscheme: " .. colorscheme local msg = "Colorscheme: " .. colorscheme

View File

@ -127,13 +127,10 @@ local plugin_specs = {
{ "sainnhe/edge", lazy = true }, { "sainnhe/edge", lazy = true },
{ "sainnhe/sonokai", lazy = true }, { "sainnhe/sonokai", lazy = true },
{ "sainnhe/gruvbox-material", lazy = true }, { "sainnhe/gruvbox-material", lazy = true },
{ "shaunsingh/nord.nvim", lazy = true },
{ "sainnhe/everforest", lazy = true }, { "sainnhe/everforest", lazy = true },
{ "EdenEast/nightfox.nvim", lazy = true }, { "EdenEast/nightfox.nvim", lazy = true },
{ "rebelot/kanagawa.nvim", lazy = true },
{ "catppuccin/nvim", name = "catppuccin", lazy = true }, { "catppuccin/nvim", name = "catppuccin", lazy = true },
{ "olimorris/onedarkpro.nvim", lazy = true }, { "olimorris/onedarkpro.nvim", lazy = true },
{ "tanvirtin/monokai.nvim", lazy = true },
{ "marko-cerovac/material.nvim", lazy = true }, { "marko-cerovac/material.nvim", lazy = true },
{ "nvim-tree/nvim-web-devicons", event = "VeryLazy" }, { "nvim-tree/nvim-web-devicons", event = "VeryLazy" },