From be036118cac45f2a711eb25ac8b22cff3b8730cb Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Wed, 6 Dec 2023 23:50:07 +0800 Subject: [PATCH] feat: optimise autosave.nvim --- .../desktop/neovim/astronvim_user/init.lua | 25 +++---------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/home/base/desktop/neovim/astronvim_user/init.lua b/home/base/desktop/neovim/astronvim_user/init.lua index 22c3d17a..c8790e6f 100644 --- a/home/base/desktop/neovim/astronvim_user/init.lua +++ b/home/base/desktop/neovim/astronvim_user/init.lua @@ -82,27 +82,10 @@ return { { "0x00-ketsu/autosave.nvim", - -- autosave.nvim should be loaded immediately. - -- it enable itself in the `config` function. - lazy = false, - -- config is executed when the plugin loads. - config = function() - require("autosave").setup({ - enable = true, - prompt_style = 'notify', - prompt_message = function() - return "Auto saved at " .. vim.fn.strftime("%H:%M:%S") - end, - events = { "InsertLeave", "TextChanged" }, - conditions = { - exists = true, - modifiable = true, - filename_is_not = {}, - filetype_is_not = {}, - }, - write_all_buffers = false, - debounce_delay = 135, - }) + -- lazy-loading on events + event = { "InsertLeave", "TextChanged" }, + opts = function(_, opts) + opts.prompt_style = "notify" -- or stdout end, },