diff --git a/lua/persisted/config.lua b/lua/persisted/config.lua index c271640..61878bd 100644 --- a/lua/persisted/config.lua +++ b/lua/persisted/config.lua @@ -37,73 +37,75 @@ function M.setup(opts) M.options = vim.tbl_deep_extend("force", {}, defaults, opts or {}) vim.fn.mkdir(M.options.save_dir, "p") - if opts.before_source then - require("persisted.deprecate").write( - "----------\n", - "The use of the ", - { "before_source", "ErrorMsg" }, - " callback.\nPlease replace with the ", - { "PersistedLoadPre", "WarningMsg" }, - { " user event. This will be removed from the plugin on " }, - { "2023-03-05", "WarningMsg" } - ) - end - if opts.after_source then - require("persisted.deprecate").write( - "----------\n", - "The use of the ", - { "after_source", "ErrorMsg" }, - " callback.\nPlease replace with the ", - { "PersistedLoadPost", "WarningMsg" }, - { " user event. This will be removed from the plugin on " }, - { "2023-03-05", "WarningMsg" } - ) - end - if opts.before_save then - require("persisted.deprecate").write( - "----------\n", - "The use of the ", - { "before_save", "ErrorMsg" }, - " callback.\nPlease replace with the ", - { "PersistedSavePre", "WarningMsg" }, - { " user event. This will be removed from the plugin on " }, - { "2023-03-05", "WarningMsg" } - ) - end - if opts.after_save then - require("persisted.deprecate").write( - "----------\n", - "The use of the ", - { "after_save", "ErrorMsg" }, - " callback.\nPlease replace with the ", - { "PersistedSavePost", "WarningMsg" }, - { " user event. This will be removed from the plugin on " }, - { "2023-03-05", "WarningMsg" } - ) - end + if opts then + if opts.before_source then + require("persisted.deprecate").write( + "----------\n", + "The use of the ", + { "before_source", "ErrorMsg" }, + " callback.\nPlease replace with the ", + { "PersistedLoadPre", "WarningMsg" }, + { " user event. This will be removed from the plugin on " }, + { "2023-03-05", "WarningMsg" } + ) + end + if opts.after_source then + require("persisted.deprecate").write( + "----------\n", + "The use of the ", + { "after_source", "ErrorMsg" }, + " callback.\nPlease replace with the ", + { "PersistedLoadPost", "WarningMsg" }, + { " user event. This will be removed from the plugin on " }, + { "2023-03-05", "WarningMsg" } + ) + end + if opts.before_save then + require("persisted.deprecate").write( + "----------\n", + "The use of the ", + { "before_save", "ErrorMsg" }, + " callback.\nPlease replace with the ", + { "PersistedSavePre", "WarningMsg" }, + { " user event. This will be removed from the plugin on " }, + { "2023-03-05", "WarningMsg" } + ) + end + if opts.after_save then + require("persisted.deprecate").write( + "----------\n", + "The use of the ", + { "after_save", "ErrorMsg" }, + " callback.\nPlease replace with the ", + { "PersistedSavePost", "WarningMsg" }, + { " user event. This will be removed from the plugin on " }, + { "2023-03-05", "WarningMsg" } + ) + end - -- Telescope - if opts.telescope and opts.telescope.before_source then - require("persisted.deprecate").write( - "----------\n", - "The use of the ", - { "telescope.before_source", "ErrorMsg" }, - " callback.\nPlease replace with the ", - { "PersistedTelescopeLoadPre", "WarningMsg" }, - { " user event. This will be removed from the plugin on "}, - { "2023-03-05", "WarningMsg" } - ) - end - if opts.telescope and opts.telescope.after_source then - require("persisted.deprecate").write( - "----------\n", - "The use of the ", - { "telescope.after_source", "ErrorMsg" }, - " callback.\nPlease replace with the ", - { "PersistedTelescopeLoadPost", "WarningMsg" }, - { " user event. This will be removed from the plugin on "}, - { "2023-03-05", "WarningMsg" } - ) + -- Telescope + if opts.telescope and opts.telescope.before_source then + require("persisted.deprecate").write( + "----------\n", + "The use of the ", + { "telescope.before_source", "ErrorMsg" }, + " callback.\nPlease replace with the ", + { "PersistedTelescopeLoadPre", "WarningMsg" }, + { " user event. This will be removed from the plugin on " }, + { "2023-03-05", "WarningMsg" } + ) + end + if opts.telescope and opts.telescope.after_source then + require("persisted.deprecate").write( + "----------\n", + "The use of the ", + { "telescope.after_source", "ErrorMsg" }, + " callback.\nPlease replace with the ", + { "PersistedTelescopeLoadPost", "WarningMsg" }, + { " user event. This will be removed from the plugin on " }, + { "2023-03-05", "WarningMsg" } + ) + end end end