diff --git a/modules/plugins/mini/notify/config.nix b/modules/plugins/mini/notify/config.nix index 2a5ff46e..6872092c 100644 --- a/modules/plugins/mini/notify/config.nix +++ b/modules/plugins/mini/notify/config.nix @@ -3,17 +3,18 @@ lib, ... }: let - inherit (lib.modules) mkIf; + inherit (lib.modules) mkIf mkAssert; inherit (lib.nvim.dag) entryAnywhere; inherit (lib.nvim.lua) toLuaObject; cfg = config.vim.mini.notify; in { - vim = mkIf cfg.enable { + vim = mkIf cfg.enable (mkAssert (!config.vim.notify.nvim-notify.enable) "Mini.notify is incompatible with nvim-notify!" { startPlugins = ["mini-notify"]; pluginRC.mini-notify = entryAnywhere '' require("mini.notify").setup(${toLuaObject cfg.setupOpts}) + vim.notify = MiniNotify.make_notify(${toLuaObject cfg.notifyOpts}) ''; - }; + }); } diff --git a/modules/plugins/mini/notify/notify.nix b/modules/plugins/mini/notify/notify.nix index e98f6e71..628be47a 100644 --- a/modules/plugins/mini/notify/notify.nix +++ b/modules/plugins/mini/notify/notify.nix @@ -3,11 +3,39 @@ lib, ... }: let - inherit (lib.options) mkEnableOption; - inherit (lib.nvim.types) mkPluginSetupOption; + inherit (lib.options) mkEnableOption mkOption; + inherit (lib.types) int str; + inherit (lib.nvim.types) mkPluginSetupOption borderType; + + mkNotifyOpt = name: duration: hl_group: { + duration = mkOption { + type = int; + default = duration; + description = "The duration of the ${name} notification"; + }; + hl_group = mkOption { + type = str; + default = hl_group; + description = "The highlight group of the ${name} notification"; + }; + }; in { options.vim.mini.notify = { enable = mkEnableOption "mini.notify"; - setupOpts = mkPluginSetupOption "mini.notify" {}; + setupOpts = mkPluginSetupOption "mini.notify" { + window.config.border = mkOption { + type = borderType; + default = config.vim.ui.borders.globalStyle; + description = "The border type for the mini.notify-notifications"; + }; + }; + notifyOpts = mkPluginSetupOption "mini.notify notifications" { + ERROR = mkNotifyOpt "error" 5000 "DiagnosticError"; + WARN = mkNotifyOpt "warn" 5000 "DiagnosticWarn"; + INFO = mkNotifyOpt "info" 5000 "DiagnosticInfo"; + DEBUG = mkNotifyOpt "debug" 0 "DiagnosticHint"; + TRACE = mkNotifyOpt "trace" 0 "DiagnosticOk"; + OFF = mkNotifyOpt "off" 0 "MiniNotifyNormal"; + }; }; }