modules/ui: switch to explicit lib calls

This commit is contained in:
NotAShelf 2024-03-15 15:01:46 +03:00 committed by Ching Pei Yang
parent db0df5c211
commit 5955d53077
9 changed files with 37 additions and 32 deletions

View file

@ -18,7 +18,7 @@ in {
type = enum defaultStyles; type = enum defaultStyles;
default = "rounded"; default = "rounded";
description = '' description = ''
The global border style to use The global border style to use.
''; '';
}; };

View file

@ -339,8 +339,8 @@ in {
package = mkOption { package = mkOption {
type = str; type = str;
default = " "; default = " ";
description = "Package icon"; description = "";
}; };
class = mkOption { class = mkOption {
@ -351,8 +351,8 @@ in {
property = mkOption { property = mkOption {
type = str; type = str;
default = " "; default = " ";
description = "Property icon"; description = "";
}; };
field = mkOption { field = mkOption {
@ -387,8 +387,8 @@ in {
variable = mkOption { variable = mkOption {
type = str; type = str;
default = "󰫧 "; default = "󰆧 ";
description = "Variable icon"; description = "";
}; };
constant = mkOption { constant = mkOption {
@ -399,8 +399,8 @@ in {
string = mkOption { string = mkOption {
type = str; type = str;
default = " "; default = " ";
description = "String icon"; description = "";
}; };
number = mkOption { number = mkOption {
@ -411,8 +411,8 @@ in {
boolean = mkOption { boolean = mkOption {
type = str; type = str;
default = " "; default = " ";
description = "Boolean icon"; description = "";
}; };
array = mkOption { array = mkOption {

View file

@ -3,9 +3,9 @@
lib, lib,
... ...
}: let }: let
inherit (lib.modules) mkIf;
inherit (lib.strings) optionalString; inherit (lib.strings) optionalString;
inherit (lib.trivial) boolToString; inherit (lib.trivial) boolToString;
inherit (lib.modules) mkIf;
inherit (lib.lists) optionals; inherit (lib.lists) optionals;
inherit (lib.nvim.lua) nullString; inherit (lib.nvim.lua) nullString;
inherit (lib.nvim.dag) entryAfter; inherit (lib.nvim.dag) entryAfter;

View file

@ -3,31 +3,37 @@
inherit (lib.types) str; inherit (lib.types) str;
in { in {
options.vim.ui.modes-nvim = { options.vim.ui.modes-nvim = {
enable = mkEnableOption "prismatic line decorations [modes.nvim]"; enable = mkEnableOption "modes.nvim's prismatic line decorations";
setCursorline = mkEnableOption "colored cursorline on current line";
setCursorline = mkOption {
type = bool;
description = "Set a colored cursorline on current line";
default = false; # looks ugly, disabled by default
};
colors = { colors = {
copy = mkOption { copy = mkOption {
type = str; type = str;
description = "The #RRGGBB color code for the visual mode highlights";
default = "#f5c359"; default = "#f5c359";
description = "The #RRGGBB color code for the visual mode highlights";
}; };
delete = mkOption { delete = mkOption {
type = str; type = str;
description = "The #RRGGBB color code for the visual mode highlights";
default = "#c75c6a"; default = "#c75c6a";
description = "The #RRGGBB color code for the visual mode highlights";
}; };
insert = mkOption { insert = mkOption {
type = str; type = str;
description = "The #RRGGBB color code for the visual mode highlights";
default = "#78ccc5"; default = "#78ccc5";
description = "The #RRGGBB color code for the visual mode highlights";
}; };
visual = mkOption { visual = mkOption {
type = str; type = str;
description = "The #RRGGBB color code for the visual mode highlights";
default = "#9745be"; default = "#9745be";
description = "The #RRGGBB color code for the visual mode highlights";
}; };
}; };
}; };

View file

@ -2,6 +2,6 @@
inherit (lib.options) mkEnableOption; inherit (lib.options) mkEnableOption;
in { in {
options.vim.ui.noice = { options.vim.ui.noice = {
enable = mkEnableOption "UI modification library [noice.nvim]"; enable = mkEnableOption "noice.nvim UI modification library";
}; };
} }

View file

@ -11,7 +11,6 @@ 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 {
stages = "${cfg.stages}", stages = "${cfg.stages}",

View file

@ -1,5 +1,5 @@
{lib, ...}: let {lib, ...}: let
inherit (lib.options) mkOption mkEnableOption; inherit (lib) mkOption mkEnableOption;
inherit (lib.types) enum int str attrsOf; inherit (lib.types) enum int str attrsOf;
in { in {
options.vim.notify.nvim-notify = { options.vim.notify.nvim-notify = {

View file

@ -7,21 +7,21 @@
inherit (lib.strings) concatStringsSep; inherit (lib.strings) concatStringsSep;
inherit (lib.nvim.lua) attrsetToLuaTable; inherit (lib.nvim.lua) attrsetToLuaTable;
inherit (lib.nvim.dag) entryAnywhere; inherit (lib.nvim.dag) entryAnywhere;
cfg = config.vim.ui.smartcolumn; cfg = config.vim.ui.smartcolumn;
in { in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
vim = { vim = {
startPlugins = ["smartcolumn"]; startPlugins = ["smartcolumn"];
luaConfigRC.smartcolumn = entryAnywhere '' vim.luaConfigRC.smartcolumn = entryAnywhere ''
require("smartcolumn").setup({ require("smartcolumn").setup({
colorcolumn = "${toString cfg.showColumnAt}", colorcolumn = "${toString cfg.showColumnAt}",
-- { "help", "text", "markdown", "NvimTree", "alpha"}, -- { "help", "text", "markdown", "NvimTree", "alpha"},
disabled_filetypes = { ${concatStringsSep ", " (map (x: "\"" + x + "\"") cfg.disabledFiletypes)} }, disabled_filetypes = { ${concatStringsSep ", " (map (x: "\"" + x + "\"") cfg.disabledFiletypes)} },
custom_colorcolumn = ${attrsetToLuaTable cfg.columnAt.languages}, custom_colorcolumn = ${attrsetToLuaTable cfg.columnAt.languages},
scope = "file", scope = "file",
}) })
''; '';
};
}; };
} }

View file

@ -1,6 +1,6 @@
{lib, ...}: let {lib, ...}: let
inherit (lib.options) mkOption mkEnableOption literalExpression; inherit (lib.options) mkOption mkEnableOption literalExpression;
inherit (lib.types) attrsOf either nullOr listOf int str submodule; inherit (lib.types) nullOr int str submodule attrsOf either listOf;
in { in {
options.vim.ui.smartcolumn = { options.vim.ui.smartcolumn = {
enable = mkEnableOption "line length indicator"; enable = mkEnableOption "line length indicator";