diff --git a/module/common/Nvim.nix b/module/common/Nvim.nix index 4a44ce1d..16d81d09 100644 --- a/module/common/Nvim.nix +++ b/module/common/Nvim.nix @@ -58,6 +58,7 @@ in { lua dofile("${nvimSrc}/plugin/Ollama.lua") lua dofile("${nvimSrc}/key/Autocomplete.lua") lua dofile("${nvimSrc}/key/Buffer.lua") + lua dofile("${nvimSrc}/key/Colorscheme.lua") lua dofile("${nvimSrc}/key/Comment.lua") lua dofile("${nvimSrc}/key/Common.lua") lua dofile("${nvimSrc}/key/Filetree.lua") diff --git a/module/common/nvim/key/Colorscheme.lua b/module/common/nvim/key/Colorscheme.lua new file mode 100644 index 00000000..0ad99fd4 --- /dev/null +++ b/module/common/nvim/key/Colorscheme.lua @@ -0,0 +1,21 @@ +function toggle_contrast() + if vim.g.gruvbox_material_background == "light" then + vim.g.gruvbox_material_background = "medium" + elseif vim.g.gruvbox_material_background == "medium" then + vim.g.gruvbox_material_background = "hard" + elseif vim.g.gruvbox_material_background == "hard" then + vim.g.gruvbox_material_background = "light" + end + vim.cmd("colorscheme gruvbox-material") +end + +function toggle_light() + if vim.o.background == "light" then + vim.o.background = "dark" + elseif vim.o.background == "dark" then + vim.o.background = "light" + end +end + +rekey_normal("[", "lua toggle_contrast()") +rekey_normal("]", "lua toggle_light()")