mirror of
https://github.com/zoriya/auto-save.nvim.git
synced 2025-12-05 22:26:12 +00:00
@@ -12,7 +12,7 @@ local cmd = vim.cmd
|
||||
local schedule = vim.schedule
|
||||
|
||||
local logger
|
||||
local autosave_running
|
||||
local autosave_running = nil
|
||||
|
||||
autocmds.create_augroup({ clear = true })
|
||||
|
||||
@@ -183,6 +183,14 @@ end
|
||||
function M.setup(custom_opts)
|
||||
cnf:set_options(custom_opts)
|
||||
logger = require("auto-save.utils.logging").new(cnf:get_options())
|
||||
|
||||
if autosave_running == nil then
|
||||
if cnf.opts.enabled then
|
||||
M.on()
|
||||
else
|
||||
M.off()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
@@ -1,15 +1,5 @@
|
||||
if vim.g.loaded_auto_save then
|
||||
return
|
||||
end
|
||||
vim.g.loaded_auto_save = true
|
||||
|
||||
local command = vim.api.nvim_create_user_command
|
||||
local cnf = require("auto-save.config").opts
|
||||
|
||||
command("ASToggle", function()
|
||||
require("auto-save").toggle()
|
||||
end, {})
|
||||
|
||||
if cnf.enabled then
|
||||
require("auto-save").on()
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user