feat!: Remove deprecated execution message (#54)

This removes the execution message and adds a comment to the README on
how to readd them via Autocommands.

Also I implemented a function to handle breaking changes. It can later
be used for https://github.com/okuuva/auto-save.nvim/pull/48

This merges in a feature branch. I would like to collect all potential
breaking changes there until we can release it all together in a version
1.0.0

---------

Co-authored-by: okuuva <okuuva@users.noreply.github.com>
This commit is contained in:
Toni Müller
2024-05-18 08:46:46 +03:00
committed by GitHub
co-authored by okuuva
parent 5fe9ab0c42
commit 1747cf21c6
4 changed files with 24 additions and 163 deletions
+18 -12
View File
@@ -2,15 +2,6 @@
Config = {
opts = {
enabled = true, -- start auto-save when the plugin is loaded (i.e. when your package manager loads it)
execution_message = {
enabled = true,
--- @type string|fun(): string
message = function() -- message to print on save
return ("AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S"))
end,
dim = 0.18, -- dim the color of `message`
cleaning_interval = 1250, -- (milliseconds) automatically clean MsgArea after displaying `message`. See :h MsgArea
},
trigger_events = { -- See :h events
--- @type TriggerEvent[]?
immediate_save = { "BufLeave", "FocusLost" }, -- vim events that trigger an immediate save
@@ -34,9 +25,24 @@ Config = {
},
}
function Config:set_options(opts)
opts = opts or {}
self.opts = vim.tbl_deep_extend("keep", opts, self.opts)
function Config:handle_deprecations(custom_opts)
if custom_opts["execution_message"] then
vim.notify(
"The `execution_message` has been removed from the auto-save.nvim plugin. Check the Readme on how to add it yourself.",
vim.log.levels.WARN
)
custom_opts["execution_message"] = nil
end
return custom_opts
end
function Config:set_options(custom_opts)
custom_opts = custom_opts or {}
custom_opts = self.handle_deprecations(custom_opts)
self.opts = vim.tbl_deep_extend("keep", custom_opts, self.opts)
end
function Config:get_options()