mirror of
https://github.com/zoriya/auto-save.nvim.git
synced 2026-08-07 22:57:49 +00:00
feat #18: global var to check for current state
This commit is contained in:
@@ -1,24 +1,26 @@
|
||||
|
||||
local opts = require("autosave.config").options
|
||||
local cmd = vim.cmd
|
||||
|
||||
local M = {}
|
||||
|
||||
local function setup_load()
|
||||
if (opts["enabled"] == true) then
|
||||
require('autosave.main').main('on')
|
||||
if opts["enabled"] == true then
|
||||
vim.g.autosave_state = true
|
||||
require("autosave.main").main("on")
|
||||
else
|
||||
vim.g.autosave_state = false
|
||||
end
|
||||
end
|
||||
|
||||
local function setup_commands()
|
||||
if (opts["on_off_commands"] == true) then
|
||||
cmd([[command! ASOn lua require'autosave.main'.main('on')]])
|
||||
cmd([[command! ASOff lua require'autosave.main'.main('off')]])
|
||||
if opts["on_off_commands"] == true then
|
||||
cmd([[command! ASOn lua require'autosave.main'.main('on')]])
|
||||
cmd([[command! ASOff lua require'autosave.main'.main('off')]])
|
||||
end
|
||||
end
|
||||
|
||||
function M.setup(custom_opts)
|
||||
require("autosave.config").set_options(custom_opts)
|
||||
require("autosave.config").set_options(custom_opts)
|
||||
setup_load()
|
||||
setup_commands()
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user