fix: option with values array

This commit is contained in:
Folke Lemaitre 2024-07-15 15:07:46 +02:00
parent 82a3ccc4d6
commit 4ca9cb6a1c
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
2 changed files with 4 additions and 4 deletions

View file

@ -122,9 +122,9 @@ LazyVim.toggle.map("<leader>uw", LazyVim.toggle("wrap"))
LazyVim.toggle.map("<leader>uL", LazyVim.toggle("relativenumber")) LazyVim.toggle.map("<leader>uL", LazyVim.toggle("relativenumber"))
LazyVim.toggle.map("<leader>ud", LazyVim.toggle.diagnostics) LazyVim.toggle.map("<leader>ud", LazyVim.toggle.diagnostics)
LazyVim.toggle.map("<leader>ul", LazyVim.toggle.number) LazyVim.toggle.map("<leader>ul", LazyVim.toggle.number)
LazyVim.toggle.map("<leader>uc", LazyVim.toggle("conceallevel", {0, vim.o.conceallevel > 0 and vim.o.conceallevel or 3})) LazyVim.toggle.map("<leader>uc", LazyVim.toggle("conceallevel", { 0, vim.o.conceallevel > 0 and vim.o.conceallevel or 2 }))
LazyVim.toggle.map("<leader>uT", LazyVim.toggle.treesitter) LazyVim.toggle.map("<leader>uT", LazyVim.toggle.treesitter)
LazyVim.toggle.map("<leader>ub", LazyVim.toggle("background", false, {"light", "dark"})) LazyVim.toggle.map("<leader>ub", LazyVim.toggle("background", { "light", "dark" }))
if vim.lsp.inlay_hint then if vim.lsp.inlay_hint then
LazyVim.toggle.map("<leader>uh", LazyVim.toggle.inlay_hints) LazyVim.toggle.map("<leader>uh", LazyVim.toggle.inlay_hints)
end end

View file

@ -81,9 +81,9 @@ function M.option(option, values)
set = function(state) set = function(state)
if values then if values then
if state then if state then
vim.opt_local[option] = values[1]
else
vim.opt_local[option] = values[2] vim.opt_local[option] = values[2]
else
vim.opt_local[option] = values[1]
end end
else else
---@diagnostic disable-next-line: no-unknown ---@diagnostic disable-next-line: no-unknown