nix-community.nixvim/plugins/utils/firenvim.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

95 lines
2.4 KiB
Nix
Raw Normal View History

2024-08-04 10:36:55 +02:00
{
lib,
config,
options,
2024-08-04 10:36:55 +02:00
pkgs,
...
}:
let
inherit (lib.nixvim) defaultNullOpts;
types = lib.nixvim.nixvimTypes;
in
2024-09-01 12:52:28 +01:00
lib.nixvim.neovim-plugin.mkNeovimPlugin {
2024-08-04 10:36:55 +02:00
name = "firenvim";
defaultPackage = pkgs.vimPlugins.firenvim;
maintainers = with lib.maintainers; [ GaetanLepage ];
settingsOptions = {
globalSettings = defaultNullOpts.mkAttrsOf' {
type = types.anything;
pluginDefault = { };
example = {
alt = "all";
};
description = "Default settings that apply to all URLs.";
};
localSettings = defaultNullOpts.mkAttrsOf' {
type = with types; attrsOf anything;
pluginDefault = { };
example = {
".*" = {
cmdline = "neovim";
content = "text";
priority = 0;
selector = "textarea";
takeover = "always";
};
"https?://[^/]+\\.co\\.uk/" = {
takeover = "never";
priority = 1;
};
};
description = ''
Map regular expressions that are tested against the full URL to settings that are used for
all URLs matched by that pattern.
When multiple patterns match a URL, the pattern with the highest "priority" value is used.
Note: regular expressions use the [JavaScript flavor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions).
'';
};
};
settingsExample = {
globalSettings.alt = "all";
localSettings = {
".*" = {
cmdline = "neovim";
content = "text";
priority = 0;
selector = "textarea";
takeover = "always";
};
"https?://[^/]+\\.co\\.uk/" = {
takeover = "never";
priority = 1;
};
};
};
settingsDescription = ''
Options fed to the `vim.g.firenvim_config` table.
'';
callSetup = false;
extraConfig =
let
opt = options.plugins.firenvim;
in
cfg: {
warnings =
lib.optional
(
config.performance.combinePlugins.enable
&& !(lib.elem "firenvim" config.performance.combinePlugins.standalonePlugins)
)
''
Nixvim (plugins.firenvim): Using `performance.combinePlugins` breaks `firenvim`.
Add this plugin to `performance.combinePlugins.standalonePlugins` to prevent any issue.
'';
globals.firenvim_config = lib.modules.mkAliasAndWrapDefsWithPriority lib.id opt.settings;
};
2024-08-04 10:36:55 +02:00
}