aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjgmdev <jgmdev@gmail.com>2022-05-24 20:12:12 -0400
committerjgmdev <jgmdev@gmail.com>2022-05-24 20:12:12 -0400
commit7bbe262002404958a3f116d34f70c31e942134fa (patch)
treec4510ebc48708eaa0fbca714a57c4a12853f9c25
parentf7242be530b3ebdfa0a92dea98d9bc5e6efbc087 (diff)
downloadlite-xl-plugins-7bbe262002404958a3f116d34f70c31e942134fa.tar.gz
lite-xl-plugins-7bbe262002404958a3f116d34f70c31e942134fa.zip
autosave: allow live disabling
-rw-r--r--plugins/autosave.lua10
1 files changed, 9 insertions, 1 deletions
diff --git a/plugins/autosave.lua b/plugins/autosave.lua
index 7691e5a..9906e93 100644
--- a/plugins/autosave.lua
+++ b/plugins/autosave.lua
@@ -11,12 +11,20 @@ local looping = false
local on_text_change = Doc.on_text_change
config.plugins.autosave = common.merge({
+ enabled = false,
-- the approximate amount of time, in seconds, that it takes to trigger an autosave
timeout = 1,
-- The config specification used by the settings gui
config_spec = {
name = "Auto Save",
{
+ label = "Enable",
+ description = "Enable or disable the auto save feature.",
+ path = "enabled",
+ type = "toggle",
+ default = false
+ },
+ {
label = "Timeout",
description = "Approximate amount of time in seconds it takes to trigger an autosave.",
path = "timeout",
@@ -55,7 +63,7 @@ end
function Doc:on_text_change(type)
-- check if file is saved
- if self.filename then
+ if config.plugins.autosave.enabled and self.filename then
updatepress()
end
return on_text_change(self, type)