mirror of
https://github.com/zoriya/auto-save.nvim.git
synced 2025-12-06 06:36:11 +00:00
chore(doc): auto-generate vimdoc
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
*auto-save.nvim.txt* For Neovim >= 0.8.0 Last change: 2024 April 25
|
||||
*auto-save.nvim.txt* For Neovim >= 0.8.0 Last change: 2024 October 10
|
||||
|
||||
==============================================================================
|
||||
Table of Contents *auto-save.nvim-table-of-contents*
|
||||
@@ -23,7 +23,6 @@ Table of Contents *auto-save.nvim-table-of-contents*
|
||||
- automatically save your changes so the world doesn’t collapse
|
||||
- highly customizable:
|
||||
- conditionals to assert whether to save or not
|
||||
- execution message (it can be dimmed and personalized)
|
||||
- events that trigger auto-save
|
||||
- debounce the save with a delay
|
||||
- hook into the lifecycle with autocommands
|
||||
@@ -47,6 +46,7 @@ LAZY.NVIM *auto-save.nvim-installation-lazy.nvim*
|
||||
>lua
|
||||
{
|
||||
"okuuva/auto-save.nvim",
|
||||
version = '^1.0.0', -- see https://devhints.io/semver, alternatively use '' to use the latest tagged release
|
||||
cmd = "ASToggle", -- optional for lazy loading on command
|
||||
event = { "InsertLeave", "TextChanged" }, -- optional for lazy loading on trigger events
|
||||
opts = {
|
||||
@@ -62,6 +62,7 @@ PACKER.NVIM *auto-save.nvim-installation-packer.nvim*
|
||||
>lua
|
||||
use({
|
||||
"okuuva/auto-save.nvim",
|
||||
tag = 'v1',
|
||||
config = function()
|
||||
require("auto-save").setup {
|
||||
-- your config goes here
|
||||
@@ -75,7 +76,7 @@ PACKER.NVIM *auto-save.nvim-installation-packer.nvim*
|
||||
VIM-PLUG *auto-save.nvim-installation-vim-plug*
|
||||
|
||||
>vim
|
||||
Plug 'okuuva/auto-save.nvim'
|
||||
Plug 'okuuva/auto-save.nvim', { 'tag': 'v1' }
|
||||
lua << EOF
|
||||
require("auto-save").setup {
|
||||
-- your config goes here
|
||||
@@ -93,14 +94,6 @@ VIM-PLUG *auto-save.nvim-installation-vim-plug*
|
||||
>lua
|
||||
{
|
||||
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 = { "InsertLeave", "TextChanged" }, -- vim events that trigger a deferred save (saves after `debounce_delay`)
|
||||
@@ -224,19 +217,18 @@ hook into:
|
||||
|
||||
It will always supply the current buffer in the `data.saved_buffer`
|
||||
|
||||
An example to always print the file name before a file is getting saved (use
|
||||
`:messages` if the execution message swallows the print):
|
||||
An example to print a message with the file name after a file got saved:
|
||||
|
||||
>lua
|
||||
local group = vim.api.nvim_create_augroup('autosave', {})
|
||||
|
||||
vim.api.nvim_create_autocmd('User', {
|
||||
pattern = 'AutoSaveWritePre',
|
||||
pattern = 'AutoSaveWritePost',
|
||||
group = group,
|
||||
callback = function(opts)
|
||||
if opts.data.saved_buffer ~= nil then
|
||||
local filename = vim.api.nvim_buf_get_name(opts.data.saved_buffer)
|
||||
print('We are about to save ' .. filename .. ' get ready captain!')
|
||||
print('AutoSave: saved ' .. filename .. ' at ' .. vim.fn.strftime('%H:%M:%S'))
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user