mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-23 05:40:44 +00:00
feat(nvim-notify): custom setup opts
This commit is contained in:
parent
64f167e7c5
commit
80fee9dae7
2 changed files with 57 additions and 45 deletions
|
@ -5,26 +5,16 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
cfg = config.vim.notify.nvim-notify;
|
cfg = config.vim.notify.nvim-notify;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
vim = {
|
vim = {
|
||||||
startPlugins = ["nvim-notify"];
|
startPlugins = ["nvim-notify"];
|
||||||
|
|
||||||
luaConfigRC.nvim-notify = entryAnywhere ''
|
luaConfigRC.nvim-notify = entryAnywhere ''
|
||||||
require('notify').setup {
|
require('notify').setup(${toLuaObject cfg.setupOpts})
|
||||||
stages = "${cfg.stages}",
|
|
||||||
timeout = ${toString cfg.timeout},
|
|
||||||
background_colour = "${cfg.background_colour}",
|
|
||||||
position = "${cfg.position}",
|
|
||||||
icons = {
|
|
||||||
ERROR = "${cfg.icons.ERROR}",
|
|
||||||
WARN = "${cfg.icons.WARN}",
|
|
||||||
INFO = "${cfg.icons.INFO}",
|
|
||||||
DEBUG = "${cfg.icons.DEBUG}",
|
|
||||||
TRACE = "${cfg.icons.TRACE}",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
-- required to fix offset_encoding errors
|
-- required to fix offset_encoding errors
|
||||||
local notify = vim.notify
|
local notify = vim.notify
|
||||||
|
|
|
@ -1,9 +1,30 @@
|
||||||
{lib, ...}: let
|
{
|
||||||
inherit (lib) mkOption mkEnableOption;
|
config,
|
||||||
inherit (lib.types) enum int str attrsOf;
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.options) mkEnableOption mkOption;
|
||||||
|
inherit (lib.modules) mkRenamedOptionModule;
|
||||||
|
inherit (lib.types) int str enum attrsOf;
|
||||||
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
in {
|
in {
|
||||||
|
imports = let
|
||||||
|
renamedSetupOpt = name:
|
||||||
|
mkRenamedOptionModule
|
||||||
|
["vim" "notify" "nvim-notify" name]
|
||||||
|
["vim" "notify" "nvim-notify" "setupOpts" name];
|
||||||
|
in [
|
||||||
|
(renamedSetupOpt "stages")
|
||||||
|
(renamedSetupOpt "timeout")
|
||||||
|
(renamedSetupOpt "background_colour")
|
||||||
|
(renamedSetupOpt "position")
|
||||||
|
(renamedSetupOpt "icons")
|
||||||
|
];
|
||||||
|
|
||||||
options.vim.notify.nvim-notify = {
|
options.vim.notify.nvim-notify = {
|
||||||
enable = mkEnableOption "nvim-notify notifications";
|
enable = mkEnableOption "nvim-notify notifications";
|
||||||
|
|
||||||
|
setupOpts = mkPluginSetupOption "nvim-notify" {
|
||||||
stages = mkOption {
|
stages = mkOption {
|
||||||
type = enum ["fade_in_slide_out" "fade_in" "slide_out" "none"];
|
type = enum ["fade_in_slide_out" "fade_in" "slide_out" "none"];
|
||||||
default = "fade_in_slide_out";
|
default = "fade_in_slide_out";
|
||||||
|
@ -40,4 +61,5 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue