mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-11-07 14:55:59 +01:00
lib: extract shared borderType
This commit is contained in:
parent
d3cd9809b2
commit
32eb9c3de6
5 changed files with 21 additions and 19 deletions
|
@ -9,7 +9,7 @@
|
||||||
typesCustom = import ./custom.nix {inherit lib;};
|
typesCustom = import ./custom.nix {inherit lib;};
|
||||||
in {
|
in {
|
||||||
inherit (typesDag) dagOf;
|
inherit (typesDag) dagOf;
|
||||||
inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption luaInline pluginType;
|
inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption luaInline pluginType borderType;
|
||||||
inherit (typesLanguage) diagnostics mkGrammarOption;
|
inherit (typesLanguage) diagnostics mkGrammarOption;
|
||||||
inherit (typesCustom) anythingConcatLists char;
|
inherit (typesCustom) anythingConcatLists char;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,9 +51,13 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
borderPresets = ["none" "single" "double" "rounded" "solid" "shadow"];
|
||||||
in {
|
in {
|
||||||
inherit extraPluginType fromInputs pluginType;
|
inherit extraPluginType fromInputs pluginType;
|
||||||
|
|
||||||
|
borderType = either (enum borderPresets) (listOf str);
|
||||||
|
|
||||||
pluginsOpt = {
|
pluginsOpt = {
|
||||||
description,
|
description,
|
||||||
example,
|
example,
|
||||||
|
|
|
@ -4,22 +4,24 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.options) mkOption mkEnableOption;
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
inherit (lib.lists) optionals;
|
inherit (lib.nvim.types) borderType;
|
||||||
inherit (lib.types) enum either listOf str;
|
|
||||||
|
|
||||||
cfg = config.vim.ui.borders;
|
cfg = config.vim.ui.borders;
|
||||||
|
|
||||||
defaultStyles = ["none" "single" "double" "rounded"];
|
|
||||||
in {
|
in {
|
||||||
options.vim.ui.borders = {
|
options.vim.ui.borders = {
|
||||||
enable = mkEnableOption "visible borders for most windows";
|
enable = mkEnableOption "visible borders for most windows";
|
||||||
|
|
||||||
globalStyle = mkOption {
|
globalStyle = mkOption {
|
||||||
type = either (enum defaultStyles) (listOf str);
|
type = borderType;
|
||||||
default = "rounded";
|
default = "rounded";
|
||||||
description = ''
|
description = ''
|
||||||
The global border style to use.
|
The global border style to use.
|
||||||
|
|
||||||
|
If a list is given, it should have a length of eight or any divisor of
|
||||||
|
eight. The array will specify the eight chars building up the border in
|
||||||
|
a clockwise fashion starting with the top-left corner.
|
||||||
'';
|
'';
|
||||||
|
example = ["╔" "═" "╗" "║" "╝" "═" "╚" "║"];
|
||||||
};
|
};
|
||||||
|
|
||||||
# TODO: make per-plugin borders configurable
|
# TODO: make per-plugin borders configurable
|
||||||
|
@ -28,7 +30,7 @@ in {
|
||||||
enable = mkEnableOption "borders for the ${name} plugin" // {default = cfg.enable;};
|
enable = mkEnableOption "borders for the ${name} plugin" // {default = cfg.enable;};
|
||||||
|
|
||||||
style = mkOption {
|
style = mkOption {
|
||||||
type = either (enum (defaultStyles ++ optionals (name != "which-key") ["shadow"])) (listOf str);
|
type = borderType;
|
||||||
default = cfg.globalStyle;
|
default = cfg.globalStyle;
|
||||||
description = "The border style to use for the ${name} plugin";
|
description = "The border style to use for the ${name} plugin";
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
inherit (lib.options) mkOption mkEnableOption;
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
inherit (lib.types) nullOr listOf enum bool str int either;
|
inherit (lib.types) nullOr listOf enum bool str int either;
|
||||||
inherit (lib.modules) mkRenamedOptionModule;
|
inherit (lib.modules) mkRenamedOptionModule;
|
||||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
inherit (lib.nvim.types) mkPluginSetupOption borderType;
|
||||||
mkSimpleIconOption = default:
|
mkSimpleIconOption = default:
|
||||||
mkOption {
|
mkOption {
|
||||||
inherit default;
|
inherit default;
|
||||||
|
@ -212,8 +212,7 @@ in {
|
||||||
# position = {}
|
# position = {}
|
||||||
|
|
||||||
border = mkOption {
|
border = mkOption {
|
||||||
# TODO: let this type accept a custom string
|
type = borderType;
|
||||||
type = either (enum ["single" "rounded" "double" "solid" "none"]) (listOf str);
|
|
||||||
default = config.vim.ui.borders.globalStyle;
|
default = config.vim.ui.borders.globalStyle;
|
||||||
description = "border style to use";
|
description = "border style to use";
|
||||||
};
|
};
|
||||||
|
@ -236,8 +235,7 @@ in {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
border = mkOption {
|
border = mkOption {
|
||||||
# TODO: let this type accept a custom string
|
type = borderType;
|
||||||
type = nullOr (either (enum ["single" "rounded" "double" "solid" "none"]) (listOf str));
|
|
||||||
default = config.vim.ui.borders.globalStyle;
|
default = config.vim.ui.borders.globalStyle;
|
||||||
description = "border style to use for the left section of Navbuddy UI";
|
description = "border style to use for the left section of Navbuddy UI";
|
||||||
};
|
};
|
||||||
|
@ -254,8 +252,7 @@ in {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
border = mkOption {
|
border = mkOption {
|
||||||
# TODO: let this type accept a custom string
|
type = borderType;
|
||||||
type = nullOr (either (enum ["single" "rounded" "double" "solid" "none"]) (listOf str));
|
|
||||||
default = config.vim.ui.borders.globalStyle;
|
default = config.vim.ui.borders.globalStyle;
|
||||||
description = "border style to use for the middle section of Navbuddy UI";
|
description = "border style to use for the middle section of Navbuddy UI";
|
||||||
};
|
};
|
||||||
|
@ -265,8 +262,7 @@ in {
|
||||||
# there is no size option for the right section, it fills the remaining space
|
# there is no size option for the right section, it fills the remaining space
|
||||||
right = {
|
right = {
|
||||||
border = mkOption {
|
border = mkOption {
|
||||||
# TODO: let this type accept a custom string
|
type = borderType;
|
||||||
type = nullOr (either (enum ["single" "rounded" "double" "solid" "none"]) (listOf str));
|
|
||||||
default = config.vim.ui.borders.globalStyle;
|
default = config.vim.ui.borders.globalStyle;
|
||||||
description = "border style to use for the right section of Navbuddy UI";
|
description = "border style to use for the right section of Navbuddy UI";
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
inherit (lib.modules) mkRemovedOptionModule mkRenamedOptionModule;
|
inherit (lib.modules) mkRemovedOptionModule mkRenamedOptionModule;
|
||||||
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
||||||
inherit (lib.strings) toUpper;
|
inherit (lib.strings) toUpper;
|
||||||
inherit (lib.types) int float bool str enum listOf attrsOf oneOf nullOr submodule either;
|
inherit (lib.types) int float bool str enum listOf attrsOf oneOf nullOr submodule;
|
||||||
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
|
inherit (lib.nvim.types) mkPluginSetupOption luaInline borderType;
|
||||||
inherit (lib.generators) mkLuaInline;
|
inherit (lib.generators) mkLuaInline;
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
|
@ -453,7 +453,7 @@ in {
|
||||||
};
|
};
|
||||||
border = mkOption {
|
border = mkOption {
|
||||||
description = "Border style of the notification window";
|
description = "Border style of the notification window";
|
||||||
type = either (enum ["none" "single" "double" "rounded" "solid" "shadow"]) (listOf str);
|
type = borderType;
|
||||||
default =
|
default =
|
||||||
if config.vim.ui.borders.enable
|
if config.vim.ui.borders.enable
|
||||||
then config.vim.ui.borders.globalStyle
|
then config.vim.ui.borders.globalStyle
|
||||||
|
|
Loading…
Reference in a new issue