23 lines
442 B
Lua
23 lines
442 B
Lua
|
local Util = require("lazy.core.util")
|
||
|
|
||
|
local M = {}
|
||
|
|
||
|
M.format_on_save = true
|
||
|
function M.toggle_format_on_save()
|
||
|
if vim.b.autoformat == false then
|
||
|
vim.b.autoformat = nil
|
||
|
M.format_on_save = true
|
||
|
else
|
||
|
M.format_on_save = not M.format_on_save
|
||
|
end
|
||
|
|
||
|
if M.format_on_save then
|
||
|
Util.info("Enabled format on save", { title = "Format" })
|
||
|
else
|
||
|
Util.warn("Disabled format on save", { title = "Format" })
|
||
|
end
|
||
|
end
|
||
|
|
||
|
|
||
|
return M
|