From 83bf8c1c984959ee8a39c8bf1114b77028a50d3e Mon Sep 17 00:00:00 2001 From: kdav5758 Date: Sun, 4 Jul 2021 21:30:19 -0500 Subject: [PATCH] fixed load at startup --- lua/autosave/init.lua | 7 +++++++ lua/autosave/main.lua | 4 ---- plugin/ascmds.vim | 3 --- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lua/autosave/init.lua b/lua/autosave/init.lua index a6c9ea4..90650d0 100644 --- a/lua/autosave/init.lua +++ b/lua/autosave/init.lua @@ -4,6 +4,12 @@ local cmd = vim.cmd local M = {} +local function setup_load() + if (opts["enabled"] == true) then + require('autosave.main').main('on') + end +end + local function setup_commands() if (opts["on_off_commands"] == true) then cmd([[command! ASOn lua require'autosave.main'.main('on')]]) @@ -13,6 +19,7 @@ end function M.setup(custom_opts) require("autosave.config").set_options(custom_opts) + setup_load() setup_commands() end diff --git a/lua/autosave/main.lua b/lua/autosave/main.lua index f6ccce1..8a1bdb8 100644 --- a/lua/autosave/main.lua +++ b/lua/autosave/main.lua @@ -58,10 +58,6 @@ function M.main(option) on() elseif (option == 'off') then off() - elseif (option == 'startup') then - if (opts["enabled"] == true) then - on() - end end end diff --git a/plugin/ascmds.vim b/plugin/ascmds.vim index d0aee2f..7fe2e80 100644 --- a/plugin/ascmds.vim +++ b/plugin/ascmds.vim @@ -6,9 +6,6 @@ if exists('g:loaded_autosave') | finish | endif let s:save_cpo = &cpo " save user coptions set cpo&vim " reset them to defaults -" main {{{ -lua require('autosave.main').main('startup') -" }}} " Interface {{{ command! ASToggle lua require'autosave.main'.main('toggle')