mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-03 05:44:31 +02:00
lib/vim-plugin: expose new helpers settingsOptionDescription
and processPrefixedGlobals
and mkSettingsOption
This commit is contained in:
parent
1d50fa4f63
commit
167167e4b3
1 changed files with 27 additions and 11 deletions
|
@ -1,5 +1,29 @@
|
||||||
{ lib }:
|
{ lib }:
|
||||||
{
|
rec {
|
||||||
|
mkSettingsOptionDescription =
|
||||||
|
{ name, globalPrefix }:
|
||||||
|
''
|
||||||
|
The configuration options for **${name}** without the `${globalPrefix}` prefix.
|
||||||
|
|
||||||
|
For example, the following settings are equivialent to these `:setglobal` commands:
|
||||||
|
- `foo_bar = 1` -> `:setglobal ${globalPrefix}foo_bar=1`
|
||||||
|
- `hello = "world"` -> `:setglobal ${globalPrefix}hello="world"`
|
||||||
|
- `some_toggle = true` -> `:setglobal ${globalPrefix}some_toggle`
|
||||||
|
- `other_toggle = false` -> `:setglobal no${globalPrefix}other_toggle`
|
||||||
|
'';
|
||||||
|
|
||||||
|
mkSettingsOption =
|
||||||
|
{
|
||||||
|
options ? { },
|
||||||
|
example ? { },
|
||||||
|
name,
|
||||||
|
globalPrefix,
|
||||||
|
}:
|
||||||
|
lib.nixvim.mkSettingsOption {
|
||||||
|
inherit options example;
|
||||||
|
description = mkSettingsOptionDescription { inherit name globalPrefix; };
|
||||||
|
};
|
||||||
|
|
||||||
mkVimPlugin =
|
mkVimPlugin =
|
||||||
{
|
{
|
||||||
name,
|
name,
|
||||||
|
@ -36,18 +60,10 @@
|
||||||
createSettingsOption = (lib.isString globalPrefix) && (globalPrefix != "");
|
createSettingsOption = (lib.isString globalPrefix) && (globalPrefix != "");
|
||||||
|
|
||||||
settingsOption = lib.optionalAttrs createSettingsOption {
|
settingsOption = lib.optionalAttrs createSettingsOption {
|
||||||
settings = lib.nixvim.mkSettingsOption {
|
settings = mkSettingsOption {
|
||||||
options = settingsOptions;
|
options = settingsOptions;
|
||||||
example = settingsExample;
|
example = settingsExample;
|
||||||
description = ''
|
inherit name globalPrefix;
|
||||||
The configuration options for **${name}** without the `${globalPrefix}` prefix.
|
|
||||||
|
|
||||||
For example, the following settings are equivialent to these `:setglobal` commands:
|
|
||||||
- `foo_bar = 1` -> `:setglobal ${globalPrefix}foo_bar=1`
|
|
||||||
- `hello = "world"` -> `:setglobal ${globalPrefix}hello="world"`
|
|
||||||
- `some_toggle = true` -> `:setglobal ${globalPrefix}some_toggle`
|
|
||||||
- `other_toggle = false` -> `:setglobal no${globalPrefix}other_toggle`
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue