From 15e21d1a73ebdde3ab10b7faefee67458004aab5 Mon Sep 17 00:00:00 2001 From: Kevin Cotugno Date: Wed, 18 Dec 2024 06:42:37 -0700 Subject: [PATCH] Update ToggleBackground mapping to use LazyVim.safe_keymap_set --- .config/nvim/lua/config/keymaps.lua | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.config/nvim/lua/config/keymaps.lua b/.config/nvim/lua/config/keymaps.lua index 16d9189..b103932 100644 --- a/.config/nvim/lua/config/keymaps.lua +++ b/.config/nvim/lua/config/keymaps.lua @@ -2,6 +2,8 @@ -- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua -- Add any additional keymaps here +local map = LazyVim.safe_keymap_set + function ToggleBackground() if vim.opt.background:get() == "dark" then vim.opt.background = "light" @@ -10,9 +12,4 @@ function ToggleBackground() end end -vim.keymap.set( - "n", - "", - "lua ToggleBackground()", - { desc = "Switch between dark and light themes", noremap = true } -) +map("n", "", "lua ToggleBackground()", { desc = "Switch between dark and light themes", noremap = true })