From 07828af70e1065e866048408f24f19cbdea04f9e Mon Sep 17 00:00:00 2001 From: Louie S Date: Tue, 7 Feb 2023 19:36:09 -0800 Subject: Add material.nvim, rewrite colorscheme.lua to handle toggling colorscheme --- lua/user/colorscheme.lua | 67 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 57 insertions(+), 10 deletions(-) (limited to 'lua/user/colorscheme.lua') diff --git a/lua/user/colorscheme.lua b/lua/user/colorscheme.lua index 8a2b2da..6601ff4 100644 --- a/lua/user/colorscheme.lua +++ b/lua/user/colorscheme.lua @@ -1,14 +1,61 @@ -local colorscheme = "legacy_slate" +local gui = false -- set to true if guicolors should be on by default +vim.g.material_style = "darker" -local status_ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme) -if not status_ok then - vim.notify("colorscheme " .. colorscheme .. " not found!") - return +local function colorscheme_set() + local colorscheme = "legacy_slate" + + if gui then + colorscheme = "material" + end + + local status_ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme) + if not status_ok then + vim.notify("colorscheme " .. colorscheme .. " not found!") + return + end + + -- Set Popup menu colors + --highlight Pmenu ctermbg=White ctermfg=Black guibg=Gray + vim.cmd("highlight Pmenu ctermbg=gray guibg=gray") + + -- Set Parentheses matching to Magenta so that it's actually visible + vim.cmd("highlight MatchParen ctermbg=none ctermfg=magenta guibg=none guifg=magenta") end --- Set Popup menu colors ---highlight Pmenu ctermbg=White ctermfg=Black guibg=Gray -vim.cmd("highlight Pmenu ctermbg=gray guibg=gray") +-- keymap for toggling colorscheme +vim.keymap.set("n", "g", function() + gui = not gui + if gui then + vim.cmd(":set termguicolors") + colorscheme_set(gui) + vim.cmd(":TSEnable highlight") + else + vim.cmd(":set notermguicolors") + colorscheme_set(gui) + vim.cmd(":TSDisable highlight") + end +end) + +colorscheme_set(gui) --- Set Parentheses matching to Magenta so that it's actually visible -vim.cmd("highlight MatchParen ctermbg=none ctermfg=magenta guibg=none guifg=magenta") +--local colorscheme = "legacy_slate" +--local gui_colorscheme = "material" +-- +--local status_ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme) +--if not status_ok then +-- vim.notify("colorscheme " .. colorscheme .. " not found!") +-- return +--end +-- +----local status_ok, _ = pcall(vim.cmd, "colorscheme " .. gui_colorscheme) +----if not status_ok then +---- vim.notify("colorscheme " .. gui_colorscheme .. " not found!") +---- return +----end +-- +---- Set Popup menu colors +----highlight Pmenu ctermbg=White ctermfg=Black guibg=Gray +--vim.cmd("highlight Pmenu ctermbg=gray guibg=gray") +-- +---- Set Parentheses matching to Magenta so that it's actually visible +--vim.cmd("highlight MatchParen ctermbg=none ctermfg=magenta guibg=none guifg=magenta") -- cgit