Better events default

This commit is contained in:
Tim Macfarlane
2021-07-17 10:04:15 +02:00
parent de73572d4e
commit 86adb4ef60
4 changed files with 9 additions and 15 deletions
+3 -3
View File
@@ -122,7 +122,7 @@ As it's stated in the TL;DR, there are already some sane defaults that you may l
```lua
enabled = true,
execution_message = "AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S"),
events = {"InsertLeave"},
events = {"InsertLeave", "TextChanged"},
conditions = {
exists = true,
filetype_is_not = {},
@@ -146,7 +146,7 @@ autosave.setup(
{
enabled = true,
execution_message = "AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S"),
events = {"InsertLeave"},
events = {"InsertLeave", "TextChanged"},
conditions = {
exists = true,
filetype_is_not = {},
@@ -174,7 +174,7 @@ autosave.setup(
{
enabled = true,
execution_message = "AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S"),
events = {"InsertLeave"},
events = {"InsertLeave", "TextChanged"},
conditions = {
exists = true,
filetype_is_not = {},
+3 -3
View File
@@ -63,7 +63,7 @@ As it's stated in the TL;DR, there are already some sane defaults that you may l
```lua
enabled = true,
execution_message = "AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S"),
events = {"InsertLeave"},
events = {"InsertLeave", "TextChanged"},
conditions = {
exists = true,
filetype_is_not = {},
@@ -85,7 +85,7 @@ autosave.setup(
{
enabled = true,
execution_message = "AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S"),
events = {"InsertLeave"},
events = {"InsertLeave", "TextChanged"},
conditions = {
exists = true,
filetype_is_not = {},
@@ -108,7 +108,7 @@ autosave.setup(
{
enabled = true,
execution_message = "AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S"),
events = {"InsertLeave"},
events = {"InsertLeave", "TextChanged"},
conditions = {
exists = true,
filetype_is_not = {},
+1 -1
View File
@@ -3,7 +3,7 @@ local config = {}
config.options = {
enabled = true,
execution_message = "AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S"),
events = {"InsertLeave"},
events = {"InsertLeave", "TextChanged"},
conditions = {
exists = true,
filetype_is_not = {},
+2 -8
View File
@@ -113,17 +113,11 @@ function M.save()
end
local function parse_events()
local events = ""
if (next(opts["events"]) == nil or opts["events"] == nil) then
events = default_event
return default_event
else
for event, _ in pairs(opts["events"]) do
events = events .. opts["events"][event] .. ","
end
return table.concat(opts["events"], ",")
end
return events
end
function M.load_autocommands()