Compare commits

...

9 commits

Author SHA1 Message Date
Ching Pei Yang
655df48249
Merge 95705bc43b into 7d824d6711 2024-08-12 11:47:53 -04:00
raf
95705bc43b
Merge branch 'main' into feature/listof-str-border 2024-08-11 21:11:16 +00:00
raf
ff9a93d3ed
Merge branch 'main' into feature/listof-str-border 2024-07-24 22:04:19 +00:00
raf
d88b1129e5
Merge branch 'main' into feature/listof-str-border 2024-07-20 08:33:39 +00:00
Pei Yang Ching
f7db34b197 docs: update rl notes 2024-07-17 12:58:30 +02:00
Pei Yang Ching
de19f0249a allow ["|" "HighlightGroup"] for border char 2024-07-17 12:48:59 +02:00
Pei Yang Ching
5c9746aa30 remove TODO 2024-07-16 13:58:02 +02:00
Pei Yang Ching
32eb9c3de6 lib: extract shared borderType 2024-07-16 13:56:48 +02:00
Pei Yang Ching
d3cd9809b2 ui: allow custom listOf str border type 2024-07-16 11:12:01 +02:00
9 changed files with 29 additions and 23 deletions

View file

@ -53,6 +53,7 @@ configuration formats.
longer filtered and thus should be used instead.
- Add dap-go for better dap configurations
- Make noice.nvim customizable
- Standardize border style options and add custom borders
[rust-tools.nvim]: https://github.com/simrat39/rust-tools.nvim
[rustaceanvim]: https://github.com/mrcjkb/rustaceanvim

View file

@ -9,7 +9,7 @@
typesCustom = import ./custom.nix {inherit lib;};
in {
inherit (typesDag) dagOf;
inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption luaInline pluginType;
inherit (typesPlugin) pluginsOpt extraPluginType mkPluginSetupOption luaInline pluginType borderType;
inherit (typesLanguage) diagnostics mkGrammarOption;
inherit (typesCustom) anythingConcatLists char;
}

View file

@ -51,9 +51,13 @@
};
};
};
borderPresets = ["none" "single" "double" "rounded" "solid" "shadow"];
in {
inherit extraPluginType fromInputs pluginType;
borderType = either (enum borderPresets) (listOf (either str (listOf str)));
pluginsOpt = {
description,
example,

View file

@ -7,6 +7,7 @@
inherit (lib.strings) optionalString;
inherit (lib.attrsets) mapAttrs;
inherit (lib.nvim.dag) entryAfter;
inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.lsp;
in {
@ -22,7 +23,7 @@ in {
${
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}
''
}
'';

View file

@ -6,6 +6,7 @@
inherit (lib.modules) mkIf;
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.binds) mkSetBinding addDescriptionsToMappings pushDownDefault;
inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.lsp;
@ -25,7 +26,7 @@ in {
pluginRC.code-action-menu = entryAnywhere ''
-- 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
${lib.optionalString cfg.nvimCodeActionMenu.show.details "vim.g.code_action_menu_show_details = true"}

View file

@ -4,31 +4,34 @@
...
}: let
inherit (lib.options) mkOption mkEnableOption;
inherit (lib.lists) optionals;
inherit (lib.types) enum;
inherit (lib.nvim.types) borderType;
cfg = config.vim.ui.borders;
defaultStyles = ["none" "single" "double" "rounded"];
in {
options.vim.ui.borders = {
enable = mkEnableOption "visible borders for most windows";
globalStyle = mkOption {
type = enum defaultStyles;
type = borderType;
default = "rounded";
description = ''
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. You can specify
a different highlight group for each character by passing a
[char, "YourHighlightGroup"] instead
'';
example = ["" "" "" "" "" "" "" ""];
};
# TODO: make per-plugin borders configurable
plugins = let
mkPluginStyleOption = name: {
enable = mkEnableOption "borders for the ${name} plugin" // {default = cfg.enable;};
style = mkOption {
type = enum (defaultStyles ++ optionals (name != "which-key") ["shadow"]);
type = borderType;
default = cfg.globalStyle;
description = "The border style to use for the ${name} plugin";
};

View file

@ -4,9 +4,9 @@
...
}: let
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.nvim.types) mkPluginSetupOption;
inherit (lib.nvim.types) mkPluginSetupOption borderType;
mkSimpleIconOption = default:
mkOption {
inherit default;
@ -212,8 +212,7 @@ in {
# position = {}
border = mkOption {
# TODO: let this type accept a custom string
type = enum ["single" "rounded" "double" "solid" "none"];
type = borderType;
default = config.vim.ui.borders.globalStyle;
description = "border style to use";
};
@ -236,8 +235,7 @@ in {
*/
border = mkOption {
# TODO: let this type accept a custom string
type = nullOr (enum ["single" "rounded" "double" "solid" "none"]);
type = borderType;
default = config.vim.ui.borders.globalStyle;
description = "border style to use for the left section of Navbuddy UI";
};
@ -254,8 +252,7 @@ in {
*/
border = mkOption {
# TODO: let this type accept a custom string
type = nullOr (enum ["single" "rounded" "double" "solid" "none"]);
type = borderType;
default = config.vim.ui.borders.globalStyle;
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
right = {
border = mkOption {
# TODO: let this type accept a custom string
type = nullOr (enum ["single" "rounded" "double" "solid" "none"]);
type = borderType;
default = config.vim.ui.borders.globalStyle;
description = "border style to use for the right section of Navbuddy UI";
};

View file

@ -25,7 +25,7 @@ in {
${optionalString config.vim.ui.borders.plugins.which-key.enable ''
window = {
border = "${config.vim.ui.borders.plugins.which-key.style}",
border = ${toLuaObject config.vim.ui.borders.plugins.which-key.style},
},
''}
})

View file

@ -7,7 +7,7 @@
inherit (lib.options) mkEnableOption mkOption literalExpression;
inherit (lib.strings) toUpper;
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;
in {
imports = [
@ -453,7 +453,7 @@ in {
};
border = mkOption {
description = "Border style of the notification window";
type = enum ["none" "single" "double" "rounded" "solid" "shadow"];
type = borderType;
default =
if config.vim.ui.borders.enable
then config.vim.ui.borders.globalStyle