Create utils.lua file and add ToggleBackground command
This commit is contained in:
@@ -36,3 +36,5 @@ require("colorizer").setup()
|
|||||||
|
|
||||||
-- Automatically formatting buffer on save
|
-- Automatically formatting buffer on save
|
||||||
vim.api.nvim_command("autocmd BufWritePre * lua vim.lsp.buf.formatting_sync()")
|
vim.api.nvim_command("autocmd BufWritePre * lua vim.lsp.buf.formatting_sync()")
|
||||||
|
|
||||||
|
vim.cmd('command! ToggleBackground lua require("utils").toggleBackground()')
|
||||||
|
|||||||
11
config/nvim/lua/utils.lua
Normal file
11
config/nvim/lua/utils.lua
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.toggleBackground = function ()
|
||||||
|
if vim.opt.background:get() == "dark" then
|
||||||
|
vim.opt.background = "light"
|
||||||
|
else
|
||||||
|
vim.opt.background = "dark"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
Reference in New Issue
Block a user