From 492bab0c47592ac8d9b47e8e74d9ae09b4ba2cd3 Mon Sep 17 00:00:00 2001 From: nmet Date: Mon, 22 Aug 2022 19:54:18 -0300 Subject: [PATCH] Fix `debounce_delay` option not being read When this file is loaded, `cnf` has default options --- lua/auto-save/init.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/auto-save/init.lua b/lua/auto-save/init.lua index 2e87591..5d5f7fe 100644 --- a/lua/auto-save/init.lua +++ b/lua/auto-save/init.lua @@ -112,10 +112,13 @@ function M.save(buf) end end -local save_func = (cnf.opts.debounce_delay > 0 and debounce(M.save, cnf.opts.debounce_delay) or M.save) +local save_func = nil local function perform_save() g.auto_save_abort = false + if save_func == nil then + save_func = (cnf.opts.debounce_delay > 0 and debounce(M.save, cnf.opts.debounce_delay) or M.save) + end save_func() end