Skip to content

Commit

Permalink
chore(doc): auto-generate vimdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Oct 10, 2024
1 parent 95544f7 commit 5fbcaac
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions doc/auto-save.nvim.txt
Original file line number Diff line number Diff line change
@@ -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*
Expand All @@ -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
Expand All @@ -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 = {
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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`)
Expand Down Expand Up @@ -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,
})
Expand Down

0 comments on commit 5fbcaac

Please sign in to comment.