summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authorLouie S <louie@example.com>2023-02-07 19:36:09 -0800
committerLouie S <louie@example.com>2023-02-07 19:36:09 -0800
commit07828af70e1065e866048408f24f19cbdea04f9e (patch)
tree254653d374795c2da016f94f8cb2de7a64de2063 /lua
parent5a1fb73ff3c8a52fe59d31c3fadd58d6f36e1999 (diff)
Add material.nvim, rewrite colorscheme.lua to handle toggling colorscheme
Diffstat (limited to 'lua')
-rw-r--r--lua/user/colorscheme.lua67
-rw-r--r--lua/user/keymaps.lua3
-rw-r--r--lua/user/plugins.lua1
3 files changed, 59 insertions, 12 deletions
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", "<leader>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")
diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua
index 9e59a68..e84cb3a 100644
--- a/lua/user/keymaps.lua
+++ b/lua/user/keymaps.lua
@@ -90,8 +90,7 @@ keymap("t", "<C-l>", "<C-\\><C-N><C-w>l", term_opts)
keymap("n", "<leader>bd", ":b#<CR>:bd#<CR>", opts) --Close buffer without closing window ('b'uffer 'd'elete)
keymap("n", "<leader>bl", ":JABSOpen<CR>", opts) --Open buffer switcher ('b'uffer 'l'ist)
--- Toggle GUI colors
-keymap("n", "<leader>g", ":set termguicolors!<CR>:TSToggle highlight<CR>", opts) -- ('g'ui)
+-- Toggle GUI colors - see colorscheme.lua
-- LSP options - see lsp/handlers.lua
diff --git a/lua/user/plugins.lua b/lua/user/plugins.lua
index b970f2b..1fa4e03 100644
--- a/lua/user/plugins.lua
+++ b/lua/user/plugins.lua
@@ -13,6 +13,7 @@ return packer.startup(function(use)
-- Colorschemes
--use "lunarvim/colorschemes" -- Additional colorschemes
+ use "marko-cerovac/material.nvim"
-- Buffers
use 'matbme/JABS.nvim'