Nvim : Add colorscheme toggles to <Leader> + [ and ].
This commit is contained in:
parent
18c2754546
commit
dd2c194b6e
|
@ -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")
|
||||
|
|
21
module/common/nvim/key/Colorscheme.lua
Normal file
21
module/common/nvim/key/Colorscheme.lua
Normal file
|
@ -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("<Leader>[", "<cmd>lua toggle_contrast()<cr>")
|
||||
rekey_normal("<Leader>]", "<cmd>lua toggle_light()<cr>")
|
Loading…
Reference in a new issue