mirror of
https://github.com/zoriya/auto-save.nvim.git
synced 2026-08-16 02:44:35 +00:00
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:
+18
-12
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user