neovim-config/lua/config/util.lua

23 lines
442 B
Lua
Raw Permalink Normal View History

2024-06-27 00:49:17 +00:00
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