From 376dd625086b825097f4672b99091fe5a1dfa2e9 Mon Sep 17 00:00:00 2001 From: Oula Kuuva Date: Sun, 12 Feb 2023 18:27:36 +0200 Subject: [PATCH] refactor: define echo_execution_message before using --- lua/auto-save/init.lua | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lua/auto-save/init.lua b/lua/auto-save/init.lua index a0f85c6..bc07447 100644 --- a/lua/auto-save/init.lua +++ b/lua/auto-save/init.lua @@ -53,6 +53,17 @@ local function debounce(lfn, duration) return inner_debounce end +local function echo_execution_message() + local msg = type(cnf.opts.execution_message.message) == "function" and cnf.opts.execution_message.message() + or cnf.opts.execution_message.message + api.nvim_echo({ { msg, AUTO_SAVE_COLOR } }, true, {}) + if cnf.opts.execution_message.cleaning_interval > 0 then + fn.timer_start(cnf.opts.execution_message.cleaning_interval, function() + cmd([[echon '']]) + end) + end +end + function M.save(buf) buf = buf or api.nvim_get_current_buf() @@ -87,17 +98,6 @@ function M.save(buf) end end -local function echo_execution_message() - local msg = type(cnf.opts.execution_message.message) == "function" and cnf.opts.execution_message.message() - or cnf.opts.execution_message.message - api.nvim_echo({ { msg, AUTO_SAVE_COLOR } }, true, {}) - if cnf.opts.execution_message.cleaning_interval > 0 then - fn.timer_start(cnf.opts.execution_message.cleaning_interval, function() - cmd([[echon '']]) - end) - end -end - local save_func = nil local function perform_save()