add autosave

This commit is contained in:
veypi 2023-09-25 17:41:10 +08:00
parent 4dd8cdeb49
commit ed4676be72
2 changed files with 33 additions and 0 deletions

View File

@ -2,6 +2,7 @@
"Comment.nvim": { "branch": "master", "commit": "38d3b7eb553872d8866f14a0dd4fe84126068fce" },
"LuaSnip": { "branch": "master", "commit": "e77fa9ad0b1f4fc6cddf54e51047e17e90c7d7ed" },
"alpha-nvim": { "branch": "main", "commit": "87c204040e3f5d4c1c95067b35905d8f8a2f2545" },
"auto-save.nvim": { "branch": "main", "commit": "610e72307d675fcc15098c5a435ad89e45aaf855" },
"bigfile.nvim": { "branch": "main", "commit": "c1bad34ce742b4f360b67ca23c873fef998240fc" },
"bufferline.nvim": { "branch": "main", "commit": "a4bd44523316928a7c4a5c09a3407d02c30b6027" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },

View File

@ -4,6 +4,38 @@ lvim.plugins = {
config = function()
end,
},
{
"okuuva/auto-save.nvim",
config = function()
require("auto-save").setup {
enabled = true, -- start auto-save when the plugin is loaded (i.e. when your package manager loads it)
execution_message = {
enabled = true,
message = function() -- message to print on save
return ("AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S"))
end,
dim = 0.18, -- dim the color of `message`
cleaning_interval = 1250, -- (milliseconds) automatically clean MsgArea after displaying `message`. See :h MsgArea
},
trigger_events = { -- See :h events
immediate_save = { "BufLeave", "FocusLost" }, -- vim events that trigger an immediate save
defer_save = {}, -- vim events that trigger a deferred save (saves after `debounce_delay`)
-- cancel_defered_save = { "InsertEnter" }, -- vim events that cancel a pending deferred save
},
-- function that takes the buffer handle and determines whether to save the current buffer or not
-- return true: if buffer is ok to be saved
-- return false: if it's not ok to be saved
-- if set to `nil` then no specific condition is applied
condition = nil,
write_all_buffers = false, -- write all buffers when the current one meets `condition`
noautocmd = false, -- do not execute autocmds when saving
debounce_delay = 1000, -- delay after which a pending save is executed
-- log debug messages to 'auto-save.log' file in neovim cache directory, set to `true` to enable
debug = false,
}
end,
},
{
"windwp/nvim-ts-autotag",
config = function()