mirror of
https://github.com/zoriya/auto-save.nvim.git
synced 2026-06-06 20:02:15 +00:00
fixed load at startup
This commit is contained in:
@@ -4,6 +4,12 @@ local cmd = vim.cmd
|
|||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
|
local function setup_load()
|
||||||
|
if (opts["enabled"] == true) then
|
||||||
|
require('autosave.main').main('on')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function setup_commands()
|
local function setup_commands()
|
||||||
if (opts["on_off_commands"] == true) then
|
if (opts["on_off_commands"] == true) then
|
||||||
cmd([[command! ASOn lua require'autosave.main'.main('on')]])
|
cmd([[command! ASOn lua require'autosave.main'.main('on')]])
|
||||||
@@ -13,6 +19,7 @@ end
|
|||||||
|
|
||||||
function M.setup(custom_opts)
|
function M.setup(custom_opts)
|
||||||
require("autosave.config").set_options(custom_opts)
|
require("autosave.config").set_options(custom_opts)
|
||||||
|
setup_load()
|
||||||
setup_commands()
|
setup_commands()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -58,10 +58,6 @@ function M.main(option)
|
|||||||
on()
|
on()
|
||||||
elseif (option == 'off') then
|
elseif (option == 'off') then
|
||||||
off()
|
off()
|
||||||
elseif (option == 'startup') then
|
|
||||||
if (opts["enabled"] == true) then
|
|
||||||
on()
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,6 @@ if exists('g:loaded_autosave') | finish | endif
|
|||||||
let s:save_cpo = &cpo " save user coptions
|
let s:save_cpo = &cpo " save user coptions
|
||||||
set cpo&vim " reset them to defaults
|
set cpo&vim " reset them to defaults
|
||||||
|
|
||||||
" main {{{
|
|
||||||
lua require('autosave.main').main('startup')
|
|
||||||
" }}}
|
|
||||||
|
|
||||||
" Interface {{{
|
" Interface {{{
|
||||||
command! ASToggle lua require'autosave.main'.main('toggle')
|
command! ASToggle lua require'autosave.main'.main('toggle')
|
||||||
|
|||||||
Reference in New Issue
Block a user