mirror of
https://github.com/zoriya/auto-save.nvim.git
synced 2026-06-05 11:29:09 +00:00
fix: #34 (needs testing)
This commit is contained in:
+17
-12
@@ -10,6 +10,7 @@ local g = vim.g
|
|||||||
local fn = vim.fn
|
local fn = vim.fn
|
||||||
local cmd = vim.cmd
|
local cmd = vim.cmd
|
||||||
local o = vim.o
|
local o = vim.o
|
||||||
|
local AUTO_SAVE_COLOR = "MsgArea"
|
||||||
|
|
||||||
api.nvim_create_augroup("AutoSave", {
|
api.nvim_create_augroup("AutoSave", {
|
||||||
clear = true,
|
clear = true,
|
||||||
@@ -75,7 +76,7 @@ function M.save(buf)
|
|||||||
|
|
||||||
callback("after_saving")
|
callback("after_saving")
|
||||||
|
|
||||||
api.nvim_echo({ { (type(cnf.execution_message.message) == "function" and cnf.execution_message.message() or cnf.execution_message.message), 'AutoSaveText' } }, true, {})
|
api.nvim_echo({ { (type(cnf.execution_message.message) == "function" and cnf.execution_message.message() or cnf.execution_message.message), AUTO_SAVE_COLOR } }, true, {})
|
||||||
if cnf.execution_message.cleaning_interval > 0 then
|
if cnf.execution_message.cleaning_interval > 0 then
|
||||||
fn.timer_start(
|
fn.timer_start(
|
||||||
cnf.execution_message.cleaning_interval,
|
cnf.execution_message.cleaning_interval,
|
||||||
@@ -102,21 +103,25 @@ function M.on()
|
|||||||
group = "AutoSave",
|
group = "AutoSave",
|
||||||
})
|
})
|
||||||
|
|
||||||
api.nvim_create_autocmd("VimEnter", {
|
api.nvim_create_autocmd({"ColorScheme"}, {
|
||||||
callback = function()
|
callback = function()
|
||||||
if cnf.execution_message.dim > 0 then
|
vim.schedule(function()
|
||||||
MSG_AREA = colors.get_hl("MsgArea")
|
if cnf.execution_message.dim > 0 then
|
||||||
MSG_AREA.background = (MSG_AREA.background or colors.get_hl("Normal")["background"])
|
MSG_AREA = colors.get_hl("MsgArea")
|
||||||
local foreground = (
|
MSG_AREA.background = (MSG_AREA.background or colors.get_hl("Normal")["background"])
|
||||||
o.background == "dark" and
|
local foreground = (
|
||||||
colors.darken((MSG_AREA.background or "#000000"), cnf.execution_message.dim, MSG_AREA.foreground) or
|
o.background == "dark" and
|
||||||
colors.lighten((MSG_AREA.background or "#ffffff"), cnf.execution_message.dim, MSG_AREA.foreground)
|
colors.darken((MSG_AREA.background or "#000000"), cnf.execution_message.dim, MSG_AREA.foreground) or
|
||||||
)
|
colors.lighten((MSG_AREA.background or "#ffffff"), cnf.execution_message.dim, MSG_AREA.foreground)
|
||||||
|
)
|
||||||
|
|
||||||
colors.highlight("AutoSaveText", { fg = foreground })
|
colors.highlight("AutoSaveText", { fg = foreground })
|
||||||
end
|
AUTO_SAVE_COLOR = "AutoSaveText"
|
||||||
|
end
|
||||||
|
end)
|
||||||
end,
|
end,
|
||||||
once = true,
|
once = true,
|
||||||
|
pattern = "*",
|
||||||
group = "AutoSave",
|
group = "AutoSave",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user