Skip to content

Commit 593f521

Browse files
committed
plugins/firenvim: init
1 parent c9a855f commit 593f521

File tree

3 files changed

+118
-0
lines changed

3 files changed

+118
-0
lines changed

plugins/default.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@
167167
./utils/easyescape.nix
168168
./utils/emmet.nix
169169
./utils/endwise.nix
170+
./utils/firenvim.nix
170171
./utils/flash.nix
171172
./utils/floaterm.nix
172173
./utils/fzf-lua.nix

plugins/utils/firenvim.nix

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
{
2+
lib,
3+
config,
4+
pkgs,
5+
...
6+
}:
7+
let
8+
inherit (lib.nixvim) defaultNullOpts;
9+
types = lib.nixvim.nixvimTypes;
10+
in
11+
lib.nixvim.neovim-plugin.mkNeovimPlugin config {
12+
name = "firenvim";
13+
defaultPackage = pkgs.vimPlugins.firenvim;
14+
15+
maintainers = with lib.maintainers; [ GaetanLepage ];
16+
17+
settingsOptions = {
18+
globalSettings = defaultNullOpts.mkAttrsOf' {
19+
type = types.anything;
20+
pluginDefault = { };
21+
example = {
22+
alt = "all";
23+
};
24+
description = "Default settings that apply to all URLs.";
25+
};
26+
27+
localSettings = defaultNullOpts.mkAttrsOf' {
28+
type = with types; attrsOf anything;
29+
pluginDefault = { };
30+
example = {
31+
".*" = {
32+
cmdline = "neovim";
33+
content = "text";
34+
priority = 0;
35+
selector = "textarea";
36+
takeover = "always";
37+
};
38+
"https?://[^/]+\\.co\\.uk/" = {
39+
takeover = "never";
40+
priority = 1;
41+
};
42+
};
43+
description = ''
44+
Map regular expressions that are tested against the full URL to settings that are used for
45+
all URLs matched by that pattern.
46+
47+
When multiple patterns match a URL, the pattern with the highest "priority" value is used.
48+
49+
Note: regular expressions use the [JavaScript flavor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions).
50+
'';
51+
};
52+
};
53+
54+
settingsExample = {
55+
globalSettings.alt = "all";
56+
localSettings = {
57+
".*" = {
58+
cmdline = "neovim";
59+
content = "text";
60+
priority = 0;
61+
selector = "textarea";
62+
takeover = "always";
63+
};
64+
"https?://[^/]+\\.co\\.uk/" = {
65+
takeover = "never";
66+
priority = 1;
67+
};
68+
};
69+
};
70+
71+
settingsDescription = ''
72+
Options fed to the `vim.g.firenvim_config` table.
73+
'';
74+
75+
callSetup = false;
76+
extraConfig = cfg: {
77+
warnings =
78+
lib.optional
79+
(
80+
config.performance.combinePlugins.enable
81+
&& !(lib.elem "firenvim" config.performance.combinePlugins.standalonePlugins)
82+
)
83+
''
84+
Nixvim (plugins.firenvim): Using `performance.combinePlugins` breaks `firenvim`.
85+
Add this plugin to `performance.combinePlugins.standalonePlugins` to prevent any issue.
86+
'';
87+
globals.firenvim_config = lib.modules.mkAliasAndWrapDefsWithPriority lib.id cfg.settings;
88+
};
89+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
empty = {
3+
plugins.firenvim.enable = true;
4+
};
5+
6+
example = {
7+
plugins.firenvim = {
8+
enable = true;
9+
10+
settings = {
11+
globalSettings.alt = "all";
12+
localSettings = {
13+
".*" = {
14+
cmdline = "neovim";
15+
content = "text";
16+
priority = 0;
17+
selector = "textarea";
18+
takeover = "always";
19+
};
20+
"https?://[^/]+\\.co\\.uk/" = {
21+
takeover = "never";
22+
priority = 1;
23+
};
24+
};
25+
};
26+
};
27+
};
28+
}

0 commit comments

Comments
 (0)