mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 00:25:42 +02:00
misc: refactor imports, prefer adding helpers
to args rather than importing it
This commit is contained in:
parent
541b694873
commit
b6724702b4
160 changed files with 697 additions and 736 deletions
|
@ -1,11 +1,10 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
helpers = import ../lib/helpers.nix {inherit lib;};
|
||||
|
||||
autoGroupOption = types.submodule {
|
||||
options = {
|
||||
clear = mkOption {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
helpers = import ../lib/helpers.nix {inherit lib;};
|
||||
commandAttributes = types.submodule {
|
||||
options = {
|
||||
command = mkOption {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
...
|
||||
} @ args:
|
||||
}:
|
||||
with lib; let
|
||||
helpers = import ../lib/helpers.nix args;
|
||||
filetypeDefinition = helpers.mkNullOrOption (types.attrsOf (
|
||||
types.oneOf [
|
||||
# Raw filetype
|
||||
|
|
|
@ -1,58 +1,57 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
...
|
||||
}: let
|
||||
helpers = import ../lib/helpers.nix {inherit lib;};
|
||||
in
|
||||
with lib; {
|
||||
options = {
|
||||
highlight = mkOption {
|
||||
type = types.attrsOf helpers.highlightType;
|
||||
default = {};
|
||||
description = "Define highlight groups";
|
||||
example = ''
|
||||
highlight = {
|
||||
Comment.fg = '#ff0000';
|
||||
};
|
||||
'';
|
||||
};
|
||||
|
||||
match = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = {};
|
||||
description = "Define match groups";
|
||||
example = ''
|
||||
match = {
|
||||
ExtraWhitespace = '\\s\\+$';
|
||||
};
|
||||
'';
|
||||
};
|
||||
}:
|
||||
with lib; {
|
||||
options = {
|
||||
highlight = mkOption {
|
||||
type = types.attrsOf helpers.highlightType;
|
||||
default = {};
|
||||
description = "Define highlight groups";
|
||||
example = ''
|
||||
highlight = {
|
||||
Comment.fg = '#ff0000';
|
||||
};
|
||||
'';
|
||||
};
|
||||
|
||||
config = mkIf (config.highlight != {} || config.match != {}) {
|
||||
extraConfigLuaPost =
|
||||
(optionalString (config.highlight != {}) ''
|
||||
-- Highlight groups {{
|
||||
do
|
||||
local highlights = ${helpers.toLuaObject config.highlight}
|
||||
match = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = {};
|
||||
description = "Define match groups";
|
||||
example = ''
|
||||
match = {
|
||||
ExtraWhitespace = '\\s\\+$';
|
||||
};
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
for k,v in pairs(highlights) do
|
||||
vim.api.nvim_set_hl(0, k, v)
|
||||
config = mkIf (config.highlight != {} || config.match != {}) {
|
||||
extraConfigLuaPost =
|
||||
(optionalString (config.highlight != {}) ''
|
||||
-- Highlight groups {{
|
||||
do
|
||||
local highlights = ${helpers.toLuaObject config.highlight}
|
||||
|
||||
for k,v in pairs(highlights) do
|
||||
vim.api.nvim_set_hl(0, k, v)
|
||||
end
|
||||
end
|
||||
-- }}
|
||||
'')
|
||||
+ (optionalString (config.match != {}) ''
|
||||
-- Match groups {{
|
||||
do
|
||||
local match = ${helpers.toLuaObject config.match}
|
||||
|
||||
for k,v in pairs(match) do
|
||||
vim.fn.matchadd(k, v)
|
||||
end
|
||||
end
|
||||
-- }}
|
||||
'')
|
||||
+ (optionalString (config.match != {}) ''
|
||||
-- Match groups {{
|
||||
do
|
||||
local match = ${helpers.toLuaObject config.match}
|
||||
|
||||
for k,v in pairs(match) do
|
||||
vim.fn.matchadd(k, v)
|
||||
end
|
||||
end
|
||||
-- }}
|
||||
'');
|
||||
};
|
||||
}
|
||||
'');
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
helpers = import ../lib/helpers.nix {inherit lib;};
|
||||
in {
|
||||
with lib; {
|
||||
options = {
|
||||
maps =
|
||||
mapAttrs
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
helpers,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
helpers = import ../lib/helpers.nix {inherit lib;};
|
||||
in {
|
||||
with lib; {
|
||||
options = {
|
||||
options = mkOption {
|
||||
type = types.attrsOf types.anything;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue