Update ToggleBackground mapping to use LazyVim.safe_keymap_set
This commit is contained in:
parent
5b3f0a99bb
commit
15e21d1a73
@ -2,6 +2,8 @@
|
|||||||
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
|
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
|
||||||
-- Add any additional keymaps here
|
-- Add any additional keymaps here
|
||||||
|
|
||||||
|
local map = LazyVim.safe_keymap_set
|
||||||
|
|
||||||
function ToggleBackground()
|
function ToggleBackground()
|
||||||
if vim.opt.background:get() == "dark" then
|
if vim.opt.background:get() == "dark" then
|
||||||
vim.opt.background = "light"
|
vim.opt.background = "light"
|
||||||
@ -10,9 +12,4 @@ function ToggleBackground()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.keymap.set(
|
map("n", "<F5>", "<cmd>lua ToggleBackground()<cr>", { desc = "Switch between dark and light themes", noremap = true })
|
||||||
"n",
|
|
||||||
"<F5>",
|
|
||||||
"<cmd>lua ToggleBackground()<cr>",
|
|
||||||
{ desc = "Switch between dark and light themes", noremap = true }
|
|
||||||
)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user