diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index 8b87ae99..90efeb5c 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -301,6 +301,7 @@ - Add more applicable filetypes to illuminate denylist. - Disable mini.indentscope for applicable filetypes. - Enable inlay hints support - `config.vim.lsp.inlayHints`. +- Add [`auto-save-nvim`](https://github.com/pocco81/auto-save.nvim). [tebuevd](https://github.com/tebuevd): diff --git a/modules/plugins/utility/auto-save/auto-save.nix b/modules/plugins/utility/auto-save/auto-save.nix new file mode 100644 index 00000000..c859d79c --- /dev/null +++ b/modules/plugins/utility/auto-save/auto-save.nix @@ -0,0 +1,17 @@ +{lib, ...}: let + inherit (lib.nvim.types) mkPluginSetupOption; + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.types) int; +in { + options.vim.auto-save = { + enable = mkEnableOption "auto-save"; + setupOpts = mkPluginSetupOption "auto-save" { + debounce_delay = mkOption { + type = int; + # plugin default is 135, adding an option to setupOpts for example + default = 100; + description = "saves the file at most every `debounce_delay` milliseconds"; + }; + }; + }; +} diff --git a/modules/plugins/utility/auto-save/config.nix b/modules/plugins/utility/auto-save/config.nix new file mode 100644 index 00000000..aa6b9f7e --- /dev/null +++ b/modules/plugins/utility/auto-save/config.nix @@ -0,0 +1,16 @@ +{ + config, + lib, + pkgs, + ... +}: let + inherit (lib.modules) mkIf; + + cfg = config.vim.auto-save; +in { + vim.lazy.plugins."auto-save.nvim" = mkIf cfg.enable { + package = pkgs.vimPlugins.auto-save-nvim; + setupModule = "auto-save"; + inherit (cfg) setupOpts; + }; +} diff --git a/modules/plugins/utility/auto-save/default.nix b/modules/plugins/utility/auto-save/default.nix new file mode 100644 index 00000000..d39962d3 --- /dev/null +++ b/modules/plugins/utility/auto-save/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./auto-save.nix + ./config.nix + ]; +} diff --git a/modules/plugins/utility/default.nix b/modules/plugins/utility/default.nix index 62b07574..34a7059f 100644 --- a/modules/plugins/utility/default.nix +++ b/modules/plugins/utility/default.nix @@ -1,5 +1,6 @@ { imports = [ + ./auto-save ./binds ./ccc ./diffview