Nvim: add ability to switch between dark and light theme
This commit is contained in:
parent
80d983447c
commit
d764006143
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "2dbef19461198630b3d7c39f414d09fb07d1fdd2" },
|
||||
"alpha-nvim": { "branch": "main", "commit": "4b36c1ca9ea475bdc006896657cf1ccc486aeffa" },
|
||||
"auto-dark-mode.nvim": { "branch": "master", "commit": "76e8d40d1e1544bae430f739d827391cbcb42fcc" },
|
||||
"bufferline.nvim": { "branch": "main", "commit": "6c456b888823d9e4832aa91c482bccd19445c009" },
|
||||
"cder.nvim": { "branch": "main", "commit": "07c9e3e8324ee7c3ffde493c1612aca0be5255d0" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
|
@ -62,4 +63,4 @@
|
|||
"vim-fugitive": { "branch": "master", "commit": "854a8df0d06b8d3fcb30fa7f2b08c62b553eee3b" },
|
||||
"vim-gnupg": { "branch": "main", "commit": "f9b608f29003dfde6450931dc0f495a912973a88" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
--- @type LazyPluginSpec
|
||||
return {
|
||||
"rebelot/kanagawa.nvim",
|
||||
dependencies = { { "f-person/auto-dark-mode.nvim", config = true } },
|
||||
--- @type KanagawaConfig
|
||||
opts = {
|
||||
compile = true,
|
||||
|
|
|
@ -1,6 +1,16 @@
|
|||
-- Display possible keybinds
|
||||
-- Here I have also defined some generic keybinds
|
||||
-- Plugin specific keybinds are set up in plugin configuration file
|
||||
|
||||
local function toggle_theme()
|
||||
local current_theme = vim.fn.eval("&background")
|
||||
if current_theme == "dark" then
|
||||
vim.cmd("set background=light")
|
||||
else
|
||||
vim.cmd("set background=dark")
|
||||
end
|
||||
end
|
||||
|
||||
--- @type LazyPluginSpec
|
||||
return {
|
||||
"folke/which-key.nvim",
|
||||
|
@ -10,6 +20,7 @@ return {
|
|||
|
||||
wk.register({
|
||||
h = { "<cmd>nohlsearch<cr>", "Turn off search highlight" },
|
||||
b = { toggle_theme, "Toggle background between dark and light" },
|
||||
}, { prefix = "<leader>" })
|
||||
|
||||
wk.register({
|
||||
|
|
Loading…
Reference in a new issue