mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
plugins/lz-n: remove with lib
This commit is contained in:
parent
aa1ae69b57
commit
a9938e06ae
1 changed files with 28 additions and 17 deletions
|
@ -3,14 +3,25 @@
|
||||||
options,
|
options,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib;
|
|
||||||
let
|
let
|
||||||
inherit (lib.nixvim) defaultNullOpts;
|
inherit (lib)
|
||||||
|
id
|
||||||
|
literalMD
|
||||||
|
mkIf
|
||||||
|
mkOption
|
||||||
|
types
|
||||||
|
;
|
||||||
|
inherit (lib.nixvim)
|
||||||
|
defaultNullOpts
|
||||||
|
mkNullOrLuaFn
|
||||||
|
mkNullOrOption'
|
||||||
|
toLuaObject
|
||||||
|
;
|
||||||
in
|
in
|
||||||
nixvim.plugins.mkNeovimPlugin {
|
lib.nixvim.plugins.mkNeovimPlugin {
|
||||||
name = "lz-n";
|
name = "lz-n";
|
||||||
packPathName = "lz.n";
|
packPathName = "lz.n";
|
||||||
maintainers = [ maintainers.psfloyd ];
|
maintainers = [ lib.maintainers.psfloyd ];
|
||||||
# NOTE: We want to load lz.n as early as possible so that triggers are respected
|
# NOTE: We want to load lz.n as early as possible so that triggers are respected
|
||||||
configLocation = "extraConfigLuaPre";
|
configLocation = "extraConfigLuaPre";
|
||||||
|
|
||||||
|
@ -44,32 +55,32 @@ nixvim.plugins.mkNeovimPlugin {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
enabled = nixvim.defaultNullOpts.mkStrLuaFnOr types.bool true ''
|
enabled = defaultNullOpts.mkStrLuaFnOr types.bool true ''
|
||||||
When false, or if the function returns false, then this plugin will not be included in the spec.
|
When false, or if the function returns false, then this plugin will not be included in the spec.
|
||||||
This option corresponds to the `enabled` property of lz.n.
|
This option corresponds to the `enabled` property of lz.n.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
beforeAll = nixvim.mkNullOrLuaFn ''
|
beforeAll = mkNullOrLuaFn ''
|
||||||
Always executed before any plugins are loaded.
|
Always executed before any plugins are loaded.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
before = nixvim.mkNullOrLuaFn ''
|
before = mkNullOrLuaFn ''
|
||||||
Executed before this plugin is loaded.
|
Executed before this plugin is loaded.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
after = nixvim.mkNullOrLuaFn ''
|
after = mkNullOrLuaFn ''
|
||||||
Executed after this plugin is loaded.
|
Executed after this plugin is loaded.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
load = nixvim.mkNullOrLuaFn ''
|
load = mkNullOrLuaFn ''
|
||||||
Can be used to override the `vim.g.lz_n.load()` function for this plugin.
|
Can be used to override the `vim.g.lz_n.load()` function for this plugin.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
priority = nixvim.defaultNullOpts.mkUnsignedInt (literalMD "`50` (or `1000` if `colorscheme` is set)") ''
|
priority = defaultNullOpts.mkUnsignedInt (literalMD "`50` (or `1000` if `colorscheme` is set)") ''
|
||||||
Only useful for start plugins (not lazy-loaded) to force loading certain plugins first.
|
Only useful for start plugins (not lazy-loaded) to force loading certain plugins first.
|
||||||
'';
|
'';
|
||||||
|
|
||||||
event = nixvim.mkNullOrOption' {
|
event = mkNullOrOption' {
|
||||||
type = types.anything;
|
type = types.anything;
|
||||||
description = ''
|
description = ''
|
||||||
Lazy-load on event. Events can be specified as BufEnter or with a pattern like BufEnter *.lua
|
Lazy-load on event. Events can be specified as BufEnter or with a pattern like BufEnter *.lua
|
||||||
|
@ -80,7 +91,7 @@ nixvim.plugins.mkNeovimPlugin {
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
cmd = nixvim.mkNullOrOption' {
|
cmd = mkNullOrOption' {
|
||||||
type = types.anything;
|
type = types.anything;
|
||||||
description = ''
|
description = ''
|
||||||
Lazy-load on command.
|
Lazy-load on command.
|
||||||
|
@ -91,7 +102,7 @@ nixvim.plugins.mkNeovimPlugin {
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
ft = nixvim.mkNullOrOption' {
|
ft = mkNullOrOption' {
|
||||||
type = types.anything;
|
type = types.anything;
|
||||||
description = ''
|
description = ''
|
||||||
Lazy-load on filetype.
|
Lazy-load on filetype.
|
||||||
|
@ -99,7 +110,7 @@ nixvim.plugins.mkNeovimPlugin {
|
||||||
example = [ "tex" ];
|
example = [ "tex" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
colorscheme = nixvim.mkNullOrOption' {
|
colorscheme = mkNullOrOption' {
|
||||||
type = types.anything;
|
type = types.anything;
|
||||||
description = ''
|
description = ''
|
||||||
Lazy-load on colorscheme.
|
Lazy-load on colorscheme.
|
||||||
|
@ -107,7 +118,7 @@ nixvim.plugins.mkNeovimPlugin {
|
||||||
example = "onedarker";
|
example = "onedarker";
|
||||||
};
|
};
|
||||||
|
|
||||||
keys = nixvim.mkNullOrOption' {
|
keys = mkNullOrOption' {
|
||||||
type = types.listOf types.anything;
|
type = types.listOf types.anything;
|
||||||
description = ''
|
description = ''
|
||||||
Lazy-load on key mapping. Mode is `n` by default.
|
Lazy-load on key mapping. Mode is `n` by default.
|
||||||
|
@ -191,9 +202,9 @@ nixvim.plugins.mkNeovimPlugin {
|
||||||
};
|
};
|
||||||
|
|
||||||
extraConfig = cfg: {
|
extraConfig = cfg: {
|
||||||
globals.lz_n = modules.mkAliasAndWrapDefsWithPriority id options.plugins.lz-n.settings;
|
globals.lz_n = lib.modules.mkAliasAndWrapDefsWithPriority id options.plugins.lz-n.settings;
|
||||||
plugins.lz-n.luaConfig.content = mkIf (cfg.plugins != [ ]) ''
|
plugins.lz-n.luaConfig.content = mkIf (cfg.plugins != [ ]) ''
|
||||||
require('lz.n').load( ${nixvim.toLuaObject cfg.plugins})
|
require('lz.n').load( ${toLuaObject cfg.plugins})
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue