From 2c375130122033c8ffb9a3bed1a333b68e92d8af Mon Sep 17 00:00:00 2001 From: Pei Yang Ching Date: Sun, 5 May 2024 02:10:14 +0200 Subject: [PATCH 01/12] colorizer: fix nonsense options --- modules/plugins/ui/colorizer/colorizer.nix | 118 ++++++--------------- modules/plugins/ui/colorizer/config.nix | 2 +- 2 files changed, 35 insertions(+), 85 deletions(-) diff --git a/modules/plugins/ui/colorizer/colorizer.nix b/modules/plugins/ui/colorizer/colorizer.nix index 364abb9..bbbad37 100644 --- a/modules/plugins/ui/colorizer/colorizer.nix +++ b/modules/plugins/ui/colorizer/colorizer.nix @@ -4,100 +4,50 @@ ... }: let inherit (lib.options) mkOption mkEnableOption; - inherit (lib.types) attrsOf attrs bool enum; + inherit (lib.types) attrsOf enum nullOr submodule; inherit (lib.modules) mkRenamedOptionModule; - inherit (lib.nvim.types) mkPluginSetupOption; + inherit (lib.nvim.config) mkBool; + + settingSubmodule = submodule { + options = { + RGB = mkBool true "Colorize #RGB hex codes"; + RRGGBB = mkBool true "Colorize #RRGGBB hex codes"; + names = mkBool true ''Colorize "Name" codes like Blue''; + RRGGBBAA = mkBool false "Colorize #RRGGBBAA hex codes"; + rgb_fn = mkBool false "Colorize CSS rgb() and rgba() functions"; + hsl_fn = mkBool false "Colorize CSS hsl() and hsla() functions"; + css = mkBool false "Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB"; + css_fn = mkBool false "Enable all CSS *functions*: rgb_fn, hsl_fn"; + mode = mkOption { + description = "Set the display mode"; + type = nullOr (enum ["foreground" "background"]); + default = null; + }; + }; + }; in { imports = [ - (mkRenamedOptionModule ["vim" "ui" "colorizer" "options"] ["vim" "ui" "colorizer" "setupOpts" "user_default_options"]) + (mkRenamedOptionModule ["vim" "ui" "colorizer" "options"] ["vim" "ui" "colorizer" "setupOpts" "defaultOptions"]) (mkRenamedOptionModule ["vim" "ui" "colorizer" "filetypes"] ["vim" "ui" "colorizer" "setupOpts" "filetypes"]) ]; options.vim.ui.colorizer = { enable = mkEnableOption "color highlighting [nvim-colorizer.lua]"; - setupOpts = mkPluginSetupOption "nvim-colorizer" { - filetypes = mkOption { - type = attrsOf attrs; - default = { - css = {}; - scss = {}; - }; - description = "Filetypes to highlight on"; - }; + defaultOptions = mkOption { + description = '' + Default options that apply to all filetypes. Filetype specific settings from + [filetypeSettings](#opt-vim.ui.colorizer.filetypeSettings) take precedence. + ''; + default = {}; + type = settingSubmodule; + }; - user_default_options = { - rgb = mkOption { - type = bool; - default = true; - description = "#RGB hex codes"; - }; - - rrggbb = mkOption { - type = bool; - default = true; - description = "#RRGGBB hex codes"; - }; - - names = mkOption { - type = bool; - default = true; - description = ''"Name" codes such as "Blue"''; - }; - - rgb_fn = mkOption { - type = bool; - default = false; - description = "CSS rgb() and rgba() functions"; - }; - - rrggbbaa = mkOption { - type = bool; - default = false; - description = "#RRGGBBAA hex codes"; - }; - - hsl_fn = mkOption { - type = bool; - default = false; - description = "CSS hsl() and hsla() functions"; - }; - - css = mkOption { - type = bool; - default = false; - description = "Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB"; - }; - - css_fn = mkOption { - type = bool; - default = false; - description = "Enable all CSS *functions*: rgb_fn, hsl_fn"; - }; - - mode = mkOption { - type = enum ["foreground" "background"]; - default = "background"; - description = "Set the display mode"; - }; - - tailwind = mkOption { - type = bool; - default = false; - description = "Enable tailwind colors"; - }; - - sass = mkOption { - type = bool; - default = false; - description = "Enable sass colors"; - }; - - alwaysUpdate = mkOption { - type = bool; - default = false; - description = "Update color values even if buffer is not focused, like when using cmp_menu, cmp_docs"; - }; + filetypeOptions = mkOption { + description = "Filetype specific settings"; + default = {}; + type = submodule { + freeformType = attrsOf settingSubmodule; }; }; }; diff --git a/modules/plugins/ui/colorizer/config.nix b/modules/plugins/ui/colorizer/config.nix index 1ff45f6..d96920d 100644 --- a/modules/plugins/ui/colorizer/config.nix +++ b/modules/plugins/ui/colorizer/config.nix @@ -15,7 +15,7 @@ in { ]; vim.luaConfigRC.colorizer = entryAnywhere '' - require('colorizer').setup(${toLuaObject cfg.setupOpts}) + require('colorizer').setup(${toLuaObject cfg.filetypeOptions}, ${toLuaObject cfg.defaultOptions}) ''; }; } From 981fe07075d2fe6e5a72e53f77179385f5685f91 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Sun, 12 May 2024 01:43:03 +0200 Subject: [PATCH 02/12] colorizer: allow null for all options --- modules/plugins/ui/colorizer/colorizer.nix | 59 ++++++++++++++++++---- 1 file changed, 49 insertions(+), 10 deletions(-) diff --git a/modules/plugins/ui/colorizer/colorizer.nix b/modules/plugins/ui/colorizer/colorizer.nix index bbbad37..eb3d491 100644 --- a/modules/plugins/ui/colorizer/colorizer.nix +++ b/modules/plugins/ui/colorizer/colorizer.nix @@ -4,20 +4,59 @@ ... }: let inherit (lib.options) mkOption mkEnableOption; - inherit (lib.types) attrsOf enum nullOr submodule; + inherit (lib.types) attrsOf enum nullOr submodule bool; inherit (lib.modules) mkRenamedOptionModule; - inherit (lib.nvim.config) mkBool; settingSubmodule = submodule { options = { - RGB = mkBool true "Colorize #RGB hex codes"; - RRGGBB = mkBool true "Colorize #RRGGBB hex codes"; - names = mkBool true ''Colorize "Name" codes like Blue''; - RRGGBBAA = mkBool false "Colorize #RRGGBBAA hex codes"; - rgb_fn = mkBool false "Colorize CSS rgb() and rgba() functions"; - hsl_fn = mkBool false "Colorize CSS hsl() and hsla() functions"; - css = mkBool false "Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB"; - css_fn = mkBool false "Enable all CSS *functions*: rgb_fn, hsl_fn"; + RGB = mkOption { + description = "Colorize #RGB hex codes"; + default = null; + type = nullOr bool; + }; + + RRGGBB = mkOption { + description = "Colorize #RRGGBB hex codes"; + default = null; + type = nullOr bool; + }; + + names = mkOption { + description = ''Colorize "Name" codes like Blue''; + default = null; + type = nullOr bool; + }; + + RRGGBBAA = mkOption { + description = "Colorize #RRGGBBAA hex codes"; + default = null; + type = nullOr bool; + }; + + rgb_fn = mkOption { + description = "Colorize CSS rgb() and rgba() functions"; + default = null; + type = nullOr bool; + }; + + hsl_fn = mkOption { + description = "Colorize CSS hsl() and hsla() functions"; + default = null; + type = nullOr bool; + }; + + css = mkOption { + description = "Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB"; + default = null; + type = nullOr bool; + }; + + css_fn = mkOption { + description = "Enable all CSS *functions*: rgb_fn, hsl_fn"; + default = null; + type = nullOr bool; + }; + mode = mkOption { description = "Set the display mode"; type = nullOr (enum ["foreground" "background"]); From 82e92a56da2a18dace58480bfed8bb01abb74e04 Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Sun, 12 May 2024 02:11:59 +0200 Subject: [PATCH 03/12] colorizer: move back to setupOpts --- modules/plugins/ui/colorizer/colorizer.nix | 62 +++++++++++++++++----- modules/plugins/ui/colorizer/config.nix | 2 +- 2 files changed, 49 insertions(+), 15 deletions(-) diff --git a/modules/plugins/ui/colorizer/colorizer.nix b/modules/plugins/ui/colorizer/colorizer.nix index eb3d491..cf367b2 100644 --- a/modules/plugins/ui/colorizer/colorizer.nix +++ b/modules/plugins/ui/colorizer/colorizer.nix @@ -4,8 +4,9 @@ ... }: let inherit (lib.options) mkOption mkEnableOption; - inherit (lib.types) attrsOf enum nullOr submodule bool; + inherit (lib.types) attrsOf enum nullOr submodule bool str; inherit (lib.modules) mkRenamedOptionModule; + inherit (lib.nvim.types) mkPluginSetupOption; settingSubmodule = submodule { options = { @@ -33,6 +34,12 @@ type = nullOr bool; }; + AARRGGBB = mkOption { + description = "Colorize 0xAARRGGBB hex codes"; + default = null; + type = nullOr bool; + }; + rgb_fn = mkOption { description = "Colorize CSS rgb() and rgba() functions"; default = null; @@ -57,11 +64,35 @@ type = nullOr bool; }; + tailwind = mkOption { + description = "Enable tailwind colors"; + default = null; + type = nullOr bool; + }; + + sass = mkOption { + description = "Enable sass colors"; + default = null; + type = nullOr bool; + }; + + virtualtext = mkOption { + description = "String to display as virtualtext"; + type = nullOr str; + default = null; + }; + mode = mkOption { description = "Set the display mode"; type = nullOr (enum ["foreground" "background"]); default = null; }; + + always_update = mkOption { + description = "Update color values even if buffer is not focused. Example use: cmp_menu, cmp_docs"; + default = null; + type = nullOr bool; + }; }; }; in { @@ -73,20 +104,23 @@ in { options.vim.ui.colorizer = { enable = mkEnableOption "color highlighting [nvim-colorizer.lua]"; - defaultOptions = mkOption { - description = '' - Default options that apply to all filetypes. Filetype specific settings from - [filetypeSettings](#opt-vim.ui.colorizer.filetypeSettings) take precedence. - ''; - default = {}; - type = settingSubmodule; - }; + setupOpts = mkPluginSetupOption "colorizer" { + filetypes = mkOption { + description = '' + Filetypes to enable on and their option overrides. - filetypeOptions = mkOption { - description = "Filetype specific settings"; - default = {}; - type = submodule { - freeformType = attrsOf settingSubmodule; + The special filetype "*" means enable on all filetypes. + ''; + default = {}; + type = submodule { + freeformType = attrsOf settingSubmodule; + }; + }; + + user_default_options = mkOption { + description = "Default options"; + default = {}; + type = settingSubmodule; }; }; }; diff --git a/modules/plugins/ui/colorizer/config.nix b/modules/plugins/ui/colorizer/config.nix index d96920d..1ff45f6 100644 --- a/modules/plugins/ui/colorizer/config.nix +++ b/modules/plugins/ui/colorizer/config.nix @@ -15,7 +15,7 @@ in { ]; vim.luaConfigRC.colorizer = entryAnywhere '' - require('colorizer').setup(${toLuaObject cfg.filetypeOptions}, ${toLuaObject cfg.defaultOptions}) + require('colorizer').setup(${toLuaObject cfg.setupOpts}) ''; }; } From 7d9f1e04818c5cb39cfd08f03e83649bb01e7cad Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Sun, 12 May 2024 02:18:04 +0200 Subject: [PATCH 04/12] colorizer: add example --- modules/plugins/ui/colorizer/colorizer.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/plugins/ui/colorizer/colorizer.nix b/modules/plugins/ui/colorizer/colorizer.nix index cf367b2..62ea28e 100644 --- a/modules/plugins/ui/colorizer/colorizer.nix +++ b/modules/plugins/ui/colorizer/colorizer.nix @@ -109,9 +109,16 @@ in { description = '' Filetypes to enable on and their option overrides. - The special filetype "*" means enable on all filetypes. + "*" means enable on all filetypes. Filetypes prefixed with "!" are disabled. ''; default = {}; + example = { + "*" = {}; + "!vim" = {}; + javascript = { + AARRGGBB = false; + }; + }; type = submodule { freeformType = attrsOf settingSubmodule; }; From 9baebb0d8221dea6effe51a4223558130b4b55ff Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Tue, 21 May 2024 22:55:54 +0200 Subject: [PATCH 05/12] colorizer: remove unneeded freeform module --- modules/plugins/ui/colorizer/colorizer.nix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/plugins/ui/colorizer/colorizer.nix b/modules/plugins/ui/colorizer/colorizer.nix index 62ea28e..02ab967 100644 --- a/modules/plugins/ui/colorizer/colorizer.nix +++ b/modules/plugins/ui/colorizer/colorizer.nix @@ -119,9 +119,7 @@ in { AARRGGBB = false; }; }; - type = submodule { - freeformType = attrsOf settingSubmodule; - }; + type = attrsOf settingSubmodule; }; user_default_options = mkOption { From f9343f1bc7f9ac6206ecf6402c29f7c13ea751c4 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Thu, 23 May 2024 03:20:05 +0300 Subject: [PATCH 06/12] statusline/lualine: equalize padding --- .../plugins/statusline/lualine/lualine.nix | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/modules/plugins/statusline/lualine/lualine.nix b/modules/plugins/statusline/lualine/lualine.nix index 7db43e0..5135794 100644 --- a/modules/plugins/statusline/lualine/lualine.nix +++ b/modules/plugins/statusline/lualine/lualine.nix @@ -153,6 +153,13 @@ in { }, } '' + '' + { + "", + draw_empty = true, + separator = { left = '', right = '' } + } + '' ]; }; @@ -175,6 +182,13 @@ in { separator = {right = ''} } '' + '' + { + "", + draw_empty = true, + separator = { left = '', right = '' } + } + '' ]; }; @@ -263,6 +277,13 @@ in { type = listOf str; description = "active config for: | A | B | C X | (Y) | Z |"; default = [ + '' + { + "", + draw_empty = true, + separator = { left = '', right = '' } + } + '' '' { 'searchcount', @@ -285,6 +306,13 @@ in { type = listOf str; description = "active config for: | A | B | C X | Y | (Z) |"; default = [ + '' + { + "", + draw_empty = true, + separator = { left = '', right = '' } + } + '' '' { "progress", From 9bbdb8d48a7dfb69937277b43ef00caf0f3f41ff Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Thu, 23 May 2024 03:27:23 +0300 Subject: [PATCH 07/12] docs/manual: add plugins page This should be helpful for listing known plugin behaviour where the behaviour is undesirable, but also unfixable --- docs/manual/manual.md | 4 ++++ docs/manual/plugins.md | 13 +++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 docs/manual/plugins.md diff --git a/docs/manual/manual.md b/docs/manual/manual.md index 3d80b0c..905a724 100644 --- a/docs/manual/manual.md +++ b/docs/manual/manual.md @@ -17,6 +17,10 @@ configuring.md hacking.md ``` +```{=include=} appendix html:into-file=//plugins.html +plugins.md +``` + ```{=include=} appendix html:into-file=//options.html options.md ``` diff --git a/docs/manual/plugins.md b/docs/manual/plugins.md new file mode 100644 index 0000000..e56e59f --- /dev/null +++ b/docs/manual/plugins.md @@ -0,0 +1,13 @@ +# Plugin specific quirks {#ch-plugins} + +At times, certain plugins refuse to play nicely. Be it as a result of generating +lua from Nix, or the state of packaging. This page shall list any plugins that +are known to misbehave, and potential workarounds. + + From 1061c920beb46ea441624a5c9665a866a9a33228 Mon Sep 17 00:00:00 2001 From: Yoni Firroloni Date: Thu, 23 May 2024 01:32:12 +0000 Subject: [PATCH 08/12] docs: add quirk about using nodejs (#298) * doc: add quircks about nodejs * doc: make shorter sentences --- docs/manual/plugins.md | 3 +++ docs/manual/plugins/nodejs.md | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 docs/manual/plugins/nodejs.md diff --git a/docs/manual/plugins.md b/docs/manual/plugins.md index e56e59f..fa464d1 100644 --- a/docs/manual/plugins.md +++ b/docs/manual/plugins.md @@ -4,6 +4,9 @@ At times, certain plugins refuse to play nicely. Be it as a result of generating lua from Nix, or the state of packaging. This page shall list any plugins that are known to misbehave, and potential workarounds. +```{=include=} chapters +plugins/nodejs.md +```