fix: deal with deprecated util methods

This commit is contained in:
Folke Lemaitre 2024-11-07 15:33:32 +01:00
parent 93a5323ba6
commit d455a7f8ce
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
7 changed files with 123 additions and 106 deletions

View file

@ -177,4 +177,20 @@ function M.setup()
end, { desc = "Show info about the formatters for the current buffer" })
end
---@param buf? boolean
function M.snacks_toggle(buf)
return Snacks.toggle({
name = "Auto Format (" .. (buf and "Buffer" or "Global") .. ")",
get = function()
if not buf then
return vim.g.autoformat == nil or vim.g.autoformat
end
return LazyVim.format.enabled()
end,
set = function(state)
LazyVim.format.enable(state, buf)
end,
})
end
return M