fix lazyloading for autosave.nvim

This commit is contained in:
siduck76 2021-09-07 15:18:33 +05:30
parent 299ce1cde3
commit f016bf634e

View File

@ -1,5 +1,7 @@
local M = {} local M = {}
local config = require("core.utils").load_config()
M.autopairs = function() M.autopairs = function()
local present1, autopairs = pcall(require, "nvim-autopairs") local present1, autopairs = pcall(require, "nvim-autopairs")
local present2, autopairs_completion = pcall(require, "nvim-autopairs.completion.cmp") local present2, autopairs_completion = pcall(require, "nvim-autopairs.completion.cmp")
@ -23,7 +25,7 @@ M.autosave = function()
end end
autosave.setup { autosave.setup {
enabled = vim.g.auto_save or false, -- takes boolean value from init.lua enabled = config.options.plugin.autosave, -- takes boolean value from chadrc.lua
execution_message = "autosaved at : " .. vim.fn.strftime "%H:%M:%S", execution_message = "autosaved at : " .. vim.fn.strftime "%H:%M:%S",
events = { "InsertLeave", "TextChanged" }, events = { "InsertLeave", "TextChanged" },
conditions = { conditions = {
@ -38,7 +40,6 @@ M.autosave = function()
end end
M.better_escape = function() M.better_escape = function()
local config = require("core.utils").load_config()
vim.g.better_escape_interval = config.options.plugin.esc_insertmode_timeout or 300 vim.g.better_escape_interval = config.options.plugin.esc_insertmode_timeout or 300
end end