From 1d98d41a7ba6281734dcdfa2f4e567c1aef02c99 Mon Sep 17 00:00:00 2001 From: kdav5758 Date: Sun, 4 Jul 2021 21:17:31 -0500 Subject: [PATCH] fix #4 #5: improved doc and clarified stuff --- README.md | 9 +++++---- doc/autosave.txt | 29 ++++++++++++++--------------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 5f581de..a0563cf 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,8 @@ # 📺 Notices Checkout the [CHANGELOG.md](https://github.com/Pocco81/AutoSave.nvim/blob/main/CHANGELOG.md) file for more information on the notices below: -- **01-07-21**: Just released! ++ **04-07-21**: Fixed #1. ++ **01-07-21**: Just released! # 📦 Installation @@ -121,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", "TextChanged"}, +events = {"InsertLeave"}, conditions = { exists = true, filetype_is_not = {}, @@ -145,7 +146,7 @@ autosave.setup( { enabled = true, execution_message = "AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S"), - events = {"InsertLeave", "TextChanged"}, + events = {"InsertLeave"}, conditions = { exists = true, filetype_is_not = {}, @@ -173,7 +174,7 @@ autosave.setup( { enabled = true, execution_message = "AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S"), - events = {"InsertLeave", "TextChanged"}, + events = {"InsertLeave"}, conditions = { exists = true, filetype_is_not = {}, diff --git a/doc/autosave.txt b/doc/autosave.txt index 1509bb4..13c64cc 100644 --- a/doc/autosave.txt +++ b/doc/autosave.txt @@ -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", "TextChanged"}, +events = {"InsertLeave"}, conditions = { exists = true, filetype_is_not = {}, @@ -85,13 +85,13 @@ autosave.setup( { enabled = true, execution_message = "AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S"), - events = {"InsertLeave", "TextChanged"}, + events = {"InsertLeave"}, conditions = { exists = true, filetype_is_not = {}, modifiable = true }, - write_all_buffers = true, + write_all_buffers = false, on_off_commands = true, clean_command_line_interval = 2500 } @@ -108,13 +108,13 @@ autosave.setup( { enabled = true, execution_message = "AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S"), - events = {"InsertLeave", "TextChanged"}, + events = {"InsertLeave"}, conditions = { exists = true, filetype_is_not = {}, modifiable = true }, - write_all_buffers = true, + write_all_buffers = false, on_off_commands = true, clean_command_line_interval = 2500 } @@ -147,7 +147,7 @@ Although settings already have self-explanatory names, here is where you can fin ## General + `enabled:`: (Boolean) if true, enables AutoSave.nvim at startup (Note: this is not for loading the plugin it self but rather the "auto-save" functionality. This is like running `:ASOn`). -+ `execution_message`: (String) message to be displayed when saving [a] file[s]. ++ `execution_message`: (String) message to be displayed when saving [a] file[s]. If the string is empty, no message will be displayed. + `events`: (Table): events that will trigger the plugin. + `write_all_buffers`: (Boolean) if true, writes to all modifiable buffers that meet the `conditions`. + `on_off_commands`: (Boolean) if true, enables extra commands for toggling the plugin on and off (`:ASOn` and `:ASOff`). @@ -162,14 +162,14 @@ These are the conditions that every file must meet so that it can be saved. If e ## Hooks Use them to execute code at certain events [described by their names]. These are the ones available: -| Function | Description | -|----------------------|--------------------------------------------------------------------| -| hook_before_on() | Before toggling the plugin on | -| hook_after_on() | After toggling the plugin on | -| hook_before_off() | Before toggling the plugin off | -| hook_after_off() | After toggling the plugin off | -| hook_before_saving() | Before its even checked if the current file(s) meet the conditions | -| hook_after_saving | After saving the file(s) | +| Function | Description | +|----------------------|----------------------------------------------------------------------| +| hook_before_on() | Before toggling the plugin on | +| hook_after_on() | After toggling the plugin on | +| hook_before_off() | Before toggling the plugin off | +| hook_after_off() | After toggling the plugin off | +| hook_before_saving() | Before its even checked if the file meets the conditions to be saved | +| hook_after_saving | After successfully saving the file or not | They can be used like so: @@ -191,4 +191,3 @@ AutoSave.nvim is released under the GPL v3.0 license. It grants open-source perm - The right to modify and distribute copies of new versions of the software For more convoluted language, see the [LICENSE file](https://github.com/Pocco81/AutoSave.nvim/blob/main/README.md). -