mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-10 09:14:31 +02:00
plugins/auto-save: switch to mkNeovimPlugin
This commit is contained in:
parent
54207d1eff
commit
49452662b7
3 changed files with 180 additions and 129 deletions
|
@ -3,47 +3,61 @@
|
|||
plugins.auto-save.enable = true;
|
||||
};
|
||||
|
||||
example = {
|
||||
plugins.auto-save = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
condition = ''
|
||||
function(buf)
|
||||
local fn = vim.fn
|
||||
local utils = require("auto-save.utils.data")
|
||||
|
||||
if utils.not_in(fn.getbufvar(buf, "&filetype"), {'oil'}) then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
'';
|
||||
write_all_buffers = true;
|
||||
debounce_delay = 1000;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
defaults = {
|
||||
plugins.auto-save = {
|
||||
enable = true;
|
||||
|
||||
keymaps = {
|
||||
silent = true;
|
||||
toggle = "<leader>s";
|
||||
};
|
||||
enableAutoSave = true;
|
||||
executionMessage = {
|
||||
message.__raw = ''
|
||||
function()
|
||||
return ("AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S"))
|
||||
end
|
||||
'';
|
||||
dim = 0.18;
|
||||
cleaningInterval = 1250;
|
||||
};
|
||||
triggerEvents = [
|
||||
"InsertLeave"
|
||||
"TextChanged"
|
||||
];
|
||||
condition = ''
|
||||
function(buf)
|
||||
local fn = vim.fn
|
||||
local utils = require("auto-save.utils.data")
|
||||
|
||||
if fn.getbufvar(buf, "&modifiable") == 1 and utils.not_in(fn.getbufvar(buf, "&filetype"), {}) then
|
||||
return true -- met condition(s), can save
|
||||
end
|
||||
return false -- can't save
|
||||
end
|
||||
'';
|
||||
writeAllBuffers = false;
|
||||
debounceDelay = 135;
|
||||
callbacks = {
|
||||
enabling = null;
|
||||
disabling = null;
|
||||
beforeAssertingSave = null;
|
||||
beforeSaving = null;
|
||||
afterSaving = null;
|
||||
settings = {
|
||||
enabled = true;
|
||||
execution_message = {
|
||||
enabled = true;
|
||||
dim = 0.18;
|
||||
cleaning_interval = 1250;
|
||||
message.__raw = ''
|
||||
function()
|
||||
return ("AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S"))
|
||||
end
|
||||
'';
|
||||
};
|
||||
trigger_events = {
|
||||
immediate_save = [
|
||||
"BufLeave"
|
||||
"FocusLost"
|
||||
];
|
||||
defer_save = [
|
||||
"InsertLeave"
|
||||
"TextChanged"
|
||||
];
|
||||
cancel_defered_save = [ "InsertEnter" ];
|
||||
};
|
||||
condition = null;
|
||||
write_all_buffers = false;
|
||||
noautocmd = false;
|
||||
lockmarks = false;
|
||||
debounce_delay = 1000;
|
||||
debug = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue