mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-22 21:30:51 +00:00
ui: allow custom listOf str border type
This commit is contained in:
parent
0f17147d52
commit
d3cd9809b2
6 changed files with 15 additions and 13 deletions
|
@ -7,6 +7,7 @@
|
||||||
inherit (lib.strings) optionalString;
|
inherit (lib.strings) optionalString;
|
||||||
inherit (lib.attrsets) mapAttrs;
|
inherit (lib.attrsets) mapAttrs;
|
||||||
inherit (lib.nvim.dag) entryAfter;
|
inherit (lib.nvim.dag) entryAfter;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
cfg = config.vim.lsp;
|
cfg = config.vim.lsp;
|
||||||
in {
|
in {
|
||||||
|
@ -22,7 +23,7 @@ in {
|
||||||
|
|
||||||
${
|
${
|
||||||
optionalString config.vim.ui.borders.enable ''
|
optionalString config.vim.ui.borders.enable ''
|
||||||
require('lspconfig.ui.windows').default_options.border = '${config.vim.ui.borders.globalStyle}'
|
require('lspconfig.ui.windows').default_options.border = ${toLuaObject config.vim.ui.borders.globalStyle}
|
||||||
''
|
''
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
inherit (lib.nvim.binds) mkSetBinding addDescriptionsToMappings pushDownDefault;
|
inherit (lib.nvim.binds) mkSetBinding addDescriptionsToMappings pushDownDefault;
|
||||||
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
|
|
||||||
cfg = config.vim.lsp;
|
cfg = config.vim.lsp;
|
||||||
|
|
||||||
|
@ -25,7 +26,7 @@ in {
|
||||||
|
|
||||||
luaConfigRC.code-action-menu = entryAnywhere ''
|
luaConfigRC.code-action-menu = entryAnywhere ''
|
||||||
-- border configuration
|
-- border configuration
|
||||||
vim.g.code_action_menu_window_border = '${config.vim.ui.borders.plugins.code-action-menu.style}'
|
vim.g.code_action_menu_window_border = ${toLuaObject config.vim.ui.borders.plugins.code-action-menu.style}
|
||||||
|
|
||||||
-- show individual sections of the code action menu
|
-- show individual sections of the code action menu
|
||||||
${lib.optionalString cfg.nvimCodeActionMenu.show.details "vim.g.code_action_menu_show_details = true"}
|
${lib.optionalString cfg.nvimCodeActionMenu.show.details "vim.g.code_action_menu_show_details = true"}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.options) mkOption mkEnableOption;
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
inherit (lib.lists) optionals;
|
inherit (lib.lists) optionals;
|
||||||
inherit (lib.types) enum;
|
inherit (lib.types) enum either listOf str;
|
||||||
|
|
||||||
cfg = config.vim.ui.borders;
|
cfg = config.vim.ui.borders;
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ in {
|
||||||
enable = mkEnableOption "visible borders for most windows";
|
enable = mkEnableOption "visible borders for most windows";
|
||||||
|
|
||||||
globalStyle = mkOption {
|
globalStyle = mkOption {
|
||||||
type = enum defaultStyles;
|
type = either (enum defaultStyles) (listOf str);
|
||||||
default = "rounded";
|
default = "rounded";
|
||||||
description = ''
|
description = ''
|
||||||
The global border style to use.
|
The global border style to use.
|
||||||
|
@ -28,7 +28,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 = enum (defaultStyles ++ optionals (name != "which-key") ["shadow"]);
|
type = either (enum (defaultStyles ++ optionals (name != "which-key") ["shadow"])) (listOf str);
|
||||||
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";
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.options) mkOption mkEnableOption;
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
inherit (lib.types) nullOr listOf enum bool str int;
|
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;
|
||||||
mkSimpleIconOption = default:
|
mkSimpleIconOption = default:
|
||||||
|
@ -213,7 +213,7 @@ in {
|
||||||
|
|
||||||
border = mkOption {
|
border = mkOption {
|
||||||
# TODO: let this type accept a custom string
|
# TODO: let this type accept a custom string
|
||||||
type = enum ["single" "rounded" "double" "solid" "none"];
|
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";
|
||||||
};
|
};
|
||||||
|
@ -237,7 +237,7 @@ in {
|
||||||
|
|
||||||
border = mkOption {
|
border = mkOption {
|
||||||
# TODO: let this type accept a custom string
|
# TODO: let this type accept a custom string
|
||||||
type = nullOr (enum ["single" "rounded" "double" "solid" "none"]);
|
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";
|
||||||
};
|
};
|
||||||
|
@ -255,7 +255,7 @@ in {
|
||||||
|
|
||||||
border = mkOption {
|
border = mkOption {
|
||||||
# TODO: let this type accept a custom string
|
# TODO: let this type accept a custom string
|
||||||
type = nullOr (enum ["single" "rounded" "double" "solid" "none"]);
|
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";
|
||||||
};
|
};
|
||||||
|
@ -266,7 +266,7 @@ in {
|
||||||
right = {
|
right = {
|
||||||
border = mkOption {
|
border = mkOption {
|
||||||
# TODO: let this type accept a custom string
|
# TODO: let this type accept a custom string
|
||||||
type = nullOr (enum ["single" "rounded" "double" "solid" "none"]);
|
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";
|
||||||
};
|
};
|
||||||
|
|
|
@ -25,7 +25,7 @@ in {
|
||||||
|
|
||||||
${optionalString config.vim.ui.borders.plugins.which-key.enable ''
|
${optionalString config.vim.ui.borders.plugins.which-key.enable ''
|
||||||
window = {
|
window = {
|
||||||
border = "${config.vim.ui.borders.plugins.which-key.style}",
|
border = ${toLuaObject config.vim.ui.borders.plugins.which-key.style},
|
||||||
},
|
},
|
||||||
''}
|
''}
|
||||||
})
|
})
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
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;
|
inherit (lib.types) int float bool str enum listOf attrsOf oneOf nullOr submodule either;
|
||||||
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
|
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
|
||||||
inherit (lib.generators) mkLuaInline;
|
inherit (lib.generators) mkLuaInline;
|
||||||
in {
|
in {
|
||||||
|
@ -453,7 +453,7 @@ in {
|
||||||
};
|
};
|
||||||
border = mkOption {
|
border = mkOption {
|
||||||
description = "Border style of the notification window";
|
description = "Border style of the notification window";
|
||||||
type = enum ["none" "single" "double" "rounded" "solid" "shadow"];
|
type = either (enum ["none" "single" "double" "rounded" "solid" "shadow"]) (listOf str);
|
||||||
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