mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-06 02:11:33 +00:00
treewide: begin restructuring the module tree
This commit is contained in:
parent
e1835f6c46
commit
7c730a78e5
254 changed files with 749 additions and 664 deletions
5
modules/plugins/ui/notifications/default.nix
Normal file
5
modules/plugins/ui/notifications/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
imports = [
|
||||
./nvim-notify
|
||||
];
|
||||
}
|
31
modules/plugins/ui/notifications/nvim-notify/config.nix
Normal file
31
modules/plugins/ui/notifications/nvim-notify/config.nix
Normal file
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
inherit (lib.nvim.lua) toLuaObject;
|
||||
|
||||
cfg = config.vim.notify.nvim-notify;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim = {
|
||||
startPlugins = ["nvim-notify"];
|
||||
|
||||
luaConfigRC.nvim-notify = entryAnywhere ''
|
||||
require('notify').setup(${toLuaObject cfg.setupOpts})
|
||||
|
||||
-- required to fix offset_encoding errors
|
||||
local notify = vim.notify
|
||||
vim.notify = function(msg, ...)
|
||||
if msg:match("warning: multiple different client offset_encodings") then
|
||||
return
|
||||
end
|
||||
|
||||
notify(msg, ...)
|
||||
end
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
6
modules/plugins/ui/notifications/nvim-notify/default.nix
Normal file
6
modules/plugins/ui/notifications/nvim-notify/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
imports = [
|
||||
./config.nix
|
||||
./nvim-notify.nix
|
||||
];
|
||||
}
|
65
modules/plugins/ui/notifications/nvim-notify/nvim-notify.nix
Normal file
65
modules/plugins/ui/notifications/nvim-notify/nvim-notify.nix
Normal file
|
@ -0,0 +1,65 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkRenamedOptionModule;
|
||||
inherit (lib.types) int str enum attrsOf;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
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 = {
|
||||
enable = mkEnableOption "nvim-notify notifications";
|
||||
|
||||
setupOpts = mkPluginSetupOption "nvim-notify" {
|
||||
stages = mkOption {
|
||||
type = enum ["fade_in_slide_out" "fade_in" "slide_out" "none"];
|
||||
default = "fade_in_slide_out";
|
||||
description = "The stages of the notification";
|
||||
};
|
||||
|
||||
timeout = mkOption {
|
||||
type = int;
|
||||
default = 1000;
|
||||
description = "The timeout of the notification";
|
||||
};
|
||||
|
||||
background_colour = mkOption {
|
||||
type = str;
|
||||
default = "#000000";
|
||||
description = "The background colour of the notification";
|
||||
};
|
||||
|
||||
position = mkOption {
|
||||
type = enum ["top_left" "top_right" "bottom_left" "bottom_right"];
|
||||
default = "top_right";
|
||||
description = "The position of the notification";
|
||||
};
|
||||
|
||||
icons = mkOption {
|
||||
type = attrsOf str;
|
||||
description = "The icons of the notification";
|
||||
default = {
|
||||
ERROR = "";
|
||||
WARN = "";
|
||||
INFO = "";
|
||||
DEBUG = "";
|
||||
TRACE = "";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue