aboutsummaryrefslogtreecommitdiff
path: root/plugins/autosave.lua
diff options
context:
space:
mode:
authorAdam Harrison <adamdharrison@gmail.com>2021-07-13 10:47:39 -0400
committerAdam Harrison <adamdharrison@gmail.com>2021-08-17 09:52:24 -0400
commit466798679e7a2889622a491c776530c06668ca9f (patch)
treec0ebb8bdc0cc940f7cce465899a126f0f79a04ba /plugins/autosave.lua
parentfb647f8f0d972e85ac323b12eb65edf9c56b48cb (diff)
downloadlite-xl-plugins-466798679e7a2889622a491c776530c06668ca9f.tar.gz
lite-xl-plugins-466798679e7a2889622a491c776530c06668ca9f.zip
Namespaced plugin configs.
Diffstat (limited to 'plugins/autosave.lua')
-rw-r--r--plugins/autosave.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/plugins/autosave.lua b/plugins/autosave.lua
index e64ba0d..ef1985d 100644
--- a/plugins/autosave.lua
+++ b/plugins/autosave.lua
@@ -10,18 +10,18 @@ local last_keypress = os.time()
local looping = false
local on_text_change = Doc.on_text_change
-- the approximate amount of time, in seconds, that it takes to trigger an autosave
-config.autosave_timeout = 1
+config.plugins.autosave = { timeout = 1 }
local function loop_for_save()
while looping do
- if os.difftime(os.time(), last_keypress) >= config.autosave_timeout then
+ if os.difftime(os.time(), last_keypress) >= config.plugins.autosave.timeout then
command.perform "doc:save"
-- stop loop
looping = false
end
-- wait the timeout. may cause timeout to be slightly imprescise
- coroutine.yield(config.autosave_timeout)
+ coroutine.yield(config.plugins.autosave.timeout)
end
end