mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-08 11:21:35 +00:00
modules/ui: switch to explicit lib calls
This commit is contained in:
parent
81b9a8a95c
commit
a7531186a8
25 changed files with 251 additions and 272 deletions
|
@ -3,37 +3,40 @@
|
|||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf nvim;
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
cfg = config.vim.notify.nvim-notify;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
vim.startPlugins = ["nvim-notify"];
|
||||
vim = {
|
||||
startPlugins = ["nvim-notify"];
|
||||
|
||||
vim.luaConfigRC.nvim-notify = nvim.dag.entryAnywhere ''
|
||||
require('notify').setup {
|
||||
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}",
|
||||
},
|
||||
}
|
||||
luaConfigRC.nvim-notify = entryAnywhere ''
|
||||
require('notify').setup {
|
||||
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
|
||||
local notify = vim.notify
|
||||
vim.notify = function(msg, ...)
|
||||
if msg:match("warning: multiple different client offset_encodings") then
|
||||
return
|
||||
-- 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
|
||||
|
||||
notify(msg, ...)
|
||||
end
|
||||
'';
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
_: {
|
||||
{
|
||||
imports = [
|
||||
./config.nix
|
||||
./nvim-notify.nix
|
||||
|
|
|
@ -1,38 +1,35 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkOption types;
|
||||
{lib, ...}: let
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) enum int str attrsOf;
|
||||
in {
|
||||
options.vim.notify.nvim-notify = {
|
||||
enable = mkEnableOption "nvim-notify notifications";
|
||||
stages = mkOption {
|
||||
type = types.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";
|
||||
description = "The stages of the notification";
|
||||
};
|
||||
|
||||
timeout = mkOption {
|
||||
type = types.int;
|
||||
type = int;
|
||||
default = 1000;
|
||||
description = "The timeout of the notification";
|
||||
};
|
||||
|
||||
background_colour = mkOption {
|
||||
type = types.str;
|
||||
type = str;
|
||||
default = "#000000";
|
||||
description = "The background colour of the notification";
|
||||
};
|
||||
|
||||
position = mkOption {
|
||||
type = types.enum ["top_left" "top_right" "bottom_left" "bottom_right"];
|
||||
type = enum ["top_left" "top_right" "bottom_left" "bottom_right"];
|
||||
default = "top_right";
|
||||
description = "The position of the notification";
|
||||
};
|
||||
|
||||
icons = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
type = attrsOf str;
|
||||
description = "The icons of the notification";
|
||||
default = {
|
||||
ERROR = "";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue