mirror of
https://github.com/zoriya/auto-save.nvim.git
synced 2025-12-06 06:36:11 +00:00
feat: allow to disable execution_message
Squashed changes from https://github.com/Pocco81/auto-save.nvim/pull/50 Got too hairy for a GH noob like me to fix properly.
This commit is contained in:
committed by
Oula Kuuva
parent
492bab0c47
commit
4db41a2155
@@ -2,6 +2,7 @@ Config = {
|
||||
opts = {
|
||||
enabled = true, -- start auto-save when the plugin is loaded (i.e. when your package manager loads it)
|
||||
execution_message = {
|
||||
enabled = true,
|
||||
message = function() -- message to print on save
|
||||
return ("AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S"))
|
||||
end,
|
||||
|
||||
@@ -82,15 +82,14 @@ function M.save(buf)
|
||||
|
||||
callback("after_saving")
|
||||
|
||||
api.nvim_echo({
|
||||
{
|
||||
(
|
||||
type(cnf.opts.execution_message.message) == "function" and cnf.opts.execution_message.message()
|
||||
or cnf.opts.execution_message.message
|
||||
),
|
||||
AUTO_SAVE_COLOR,
|
||||
},
|
||||
}, true, {})
|
||||
if cnf.opts.execution_message.enabled == true then
|
||||
echo_execution_message()
|
||||
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 '']])
|
||||
|
||||
Reference in New Issue
Block a user