mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-11-09 14:45:58 +01:00
Compare commits
11 commits
28e536182a
...
c92b490233
Author | SHA1 | Date | |
---|---|---|---|
|
c92b490233 | ||
|
2c9a9b4d29 | ||
|
68ca227a87 | ||
|
69257c03a3 | ||
|
ac20dfbdd4 | ||
|
af72dc105d | ||
|
8aa3a23e97 | ||
|
7d9f1e0481 | ||
|
82e92a56da | ||
|
981fe07075 | ||
|
2c37513012 |
4 changed files with 119 additions and 92 deletions
|
@ -19,6 +19,8 @@ Release notes for release 0.7
|
||||||
[horriblename](https://github.com/horriblename):
|
[horriblename](https://github.com/horriblename):
|
||||||
|
|
||||||
- Fix broken treesitter-context keybinds in visual mode
|
- Fix broken treesitter-context keybinds in visual mode
|
||||||
|
- Depcrecate use of `__empty` to define empty tables in lua. Empty attrset are
|
||||||
|
no longer filtered and thus should be used instead.
|
||||||
|
|
||||||
[NotAShelf](https://github.com/notashelf)
|
[NotAShelf](https://github.com/notashelf)
|
||||||
|
|
||||||
|
|
12
lib/lua.nix
12
lib/lua.nix
|
@ -3,7 +3,7 @@
|
||||||
inherit (builtins) hasAttr head throw typeOf isList isAttrs isBool isInt isString isPath isFloat toJSON;
|
inherit (builtins) hasAttr head throw typeOf isList isAttrs isBool isInt isString isPath isFloat toJSON;
|
||||||
inherit (lib.attrsets) mapAttrsToList filterAttrs;
|
inherit (lib.attrsets) mapAttrsToList filterAttrs;
|
||||||
inherit (lib.strings) concatStringsSep concatMapStringsSep stringToCharacters;
|
inherit (lib.strings) concatStringsSep concatMapStringsSep stringToCharacters;
|
||||||
inherit (lib.trivial) boolToString;
|
inherit (lib.trivial) boolToString warn;
|
||||||
in rec {
|
in rec {
|
||||||
wrapLuaConfig = {
|
wrapLuaConfig = {
|
||||||
luaBefore ? "",
|
luaBefore ? "",
|
||||||
|
@ -66,7 +66,10 @@ in rec {
|
||||||
if isLuaInline args
|
if isLuaInline args
|
||||||
then args.expr
|
then args.expr
|
||||||
else if hasAttr "__empty" args
|
else if hasAttr "__empty" args
|
||||||
then "{ }"
|
then
|
||||||
|
warn ''
|
||||||
|
Using `__empty` to define an empty lua table is deprecated. Use an empty attrset instead.
|
||||||
|
'' "{ }"
|
||||||
else
|
else
|
||||||
"{"
|
"{"
|
||||||
+ (concatStringsSep ","
|
+ (concatStringsSep ","
|
||||||
|
@ -76,10 +79,7 @@ in rec {
|
||||||
then toLuaObject v
|
then toLuaObject v
|
||||||
else "[${toLuaObject n}] = " + (toLuaObject v))
|
else "[${toLuaObject n}] = " + (toLuaObject v))
|
||||||
(filterAttrs
|
(filterAttrs
|
||||||
(
|
(_: v: v != null)
|
||||||
_: v:
|
|
||||||
(v != null) && (toLuaObject v != "{}")
|
|
||||||
)
|
|
||||||
args)))
|
args)))
|
||||||
+ "}"
|
+ "}"
|
||||||
else if isList args
|
else if isList args
|
||||||
|
|
|
@ -4,100 +4,130 @@
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib.options) mkOption mkEnableOption;
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
inherit (lib.types) attrsOf attrs bool enum;
|
inherit (lib.types) attrsOf enum nullOr submodule bool str;
|
||||||
inherit (lib.modules) mkRenamedOptionModule;
|
inherit (lib.modules) mkRenamedOptionModule;
|
||||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||||
|
|
||||||
|
settingSubmodule = submodule {
|
||||||
|
options = {
|
||||||
|
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;
|
||||||
|
};
|
||||||
|
|
||||||
|
AARRGGBB = mkOption {
|
||||||
|
description = "Colorize 0xAARRGGBB 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;
|
||||||
|
};
|
||||||
|
|
||||||
|
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 {
|
in {
|
||||||
imports = [
|
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"])
|
(mkRenamedOptionModule ["vim" "ui" "colorizer" "filetypes"] ["vim" "ui" "colorizer" "setupOpts" "filetypes"])
|
||||||
];
|
];
|
||||||
|
|
||||||
options.vim.ui.colorizer = {
|
options.vim.ui.colorizer = {
|
||||||
enable = mkEnableOption "color highlighting [nvim-colorizer.lua]";
|
enable = mkEnableOption "color highlighting [nvim-colorizer.lua]";
|
||||||
|
|
||||||
setupOpts = mkPluginSetupOption "nvim-colorizer" {
|
setupOpts = mkPluginSetupOption "colorizer" {
|
||||||
filetypes = mkOption {
|
filetypes = mkOption {
|
||||||
type = attrsOf attrs;
|
description = ''
|
||||||
default = {
|
Filetypes to enable on and their option overrides.
|
||||||
css = {};
|
|
||||||
scss = {};
|
"*" means enable on all filetypes. Filetypes prefixed with "!" are disabled.
|
||||||
|
'';
|
||||||
|
default = {};
|
||||||
|
example = {
|
||||||
|
"*" = {};
|
||||||
|
"!vim" = {};
|
||||||
|
javascript = {
|
||||||
|
AARRGGBB = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
type = submodule {
|
||||||
|
freeformType = attrsOf settingSubmodule;
|
||||||
};
|
};
|
||||||
description = "Filetypes to highlight on";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
user_default_options = {
|
user_default_options = mkOption {
|
||||||
rgb = mkOption {
|
description = "Default options";
|
||||||
type = bool;
|
default = {};
|
||||||
default = true;
|
type = settingSubmodule;
|
||||||
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";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -60,16 +60,11 @@
|
||||||
config = (attrs) the configuration options for this mapping (noremap, silent...)
|
config = (attrs) the configuration options for this mapping (noremap, silent...)
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
normalizeAction = action: let
|
normalizeAction = action: {
|
||||||
# Extract the values of the config options that have been explicitly set by the user
|
# Extract the values of the config options that have been explicitly set by the user
|
||||||
config =
|
config =
|
||||||
filterAttrs (_: v: v != null)
|
filterAttrs (_: v: v != null)
|
||||||
(getAttrs (attrNames mapConfigOptions) action);
|
(getAttrs (attrNames mapConfigOptions) action);
|
||||||
in {
|
|
||||||
config =
|
|
||||||
if config == {}
|
|
||||||
then {"__empty" = null;}
|
|
||||||
else config;
|
|
||||||
action =
|
action =
|
||||||
if action.lua
|
if action.lua
|
||||||
then mkLuaInline action.action
|
then mkLuaInline action.action
|
||||||
|
|
Loading…
Reference in a new issue