Skip to content

Commit 12108f4

Browse files
committed
Adds option to force nixvim background transparency
1 parent 8bb621e commit 12108f4

File tree

1 file changed

+51
-22
lines changed

1 file changed

+51
-22
lines changed

modules/nixvim/nixvim.nix

Lines changed: 51 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,61 @@
44
options,
55
...
66
}: {
7-
options.stylix.targets.nixvim.enable =
8-
config.lib.stylix.mkEnableTarget "nixvim" (config.programs ? nixvim);
7+
options.stylix.targets.nixvim = {
8+
enable =
9+
config.lib.stylix.mkEnableTarget "nixvim" (config.programs ? nixvim);
10+
transparent_bg = {
11+
main = lib.mkEnableOption "background transparency for the main NeoVim window";
12+
sign_column = lib.mkEnableOption "background transparency for the NeoVim sign column";
13+
};
14+
};
915

1016
config = lib.mkIf ((config.programs ? nixvim) && config.stylix.targets.nixvim.enable) (
1117
lib.optionalAttrs (builtins.hasAttr "nixvim" options.programs) {
12-
programs.nixvim.colorschemes.base16.customColorScheme = let
13-
colors = config.lib.stylix.colors.withHashtag;
14-
in {
15-
base00 = colors.base00;
16-
base01 = colors.base01;
17-
base02 = colors.base02;
18-
base03 = colors.base03;
19-
base04 = colors.base04;
20-
base05 = colors.base05;
21-
base06 = colors.base06;
22-
base07 = colors.base07;
23-
base08 = colors.base08;
24-
base09 = colors.base09;
25-
base0A = colors.base0A;
26-
base0B = colors.base0B;
27-
base0C = colors.base0C;
28-
base0D = colors.base0D;
29-
base0E = colors.base0E;
30-
base0F = colors.base0F;
18+
programs.nixvim = {
19+
colorschemes.base16 = {
20+
customColorScheme = let
21+
colors = config.lib.stylix.colors.withHashtag;
22+
in {
23+
base00 = colors.base00;
24+
base01 = colors.base01;
25+
base02 = colors.base02;
26+
base03 = colors.base03;
27+
base04 = colors.base04;
28+
base05 = colors.base05;
29+
base06 = colors.base06;
30+
base07 = colors.base07;
31+
base08 = colors.base08;
32+
base09 = colors.base09;
33+
base0A = colors.base0A;
34+
base0B = colors.base0B;
35+
base0C = colors.base0C;
36+
base0D = colors.base0D;
37+
base0E = colors.base0E;
38+
base0F = colors.base0F;
39+
};
40+
41+
enable = true;
42+
};
43+
44+
extraConfigLuaPost = let
45+
transparency_cfg = config.stylix.targets.nixvim.transparent_bg;
46+
vim_cmds = lib.strings.concatLines ((lib.optionals transparency_cfg.main [
47+
"highlight Normal guibg=none"
48+
"highlight NonText guibg=none"
49+
"highlight Normal ctermbg=none"
50+
"highlight NonText ctermbg=none"
51+
])
52+
++ (lib.optionals transparency_cfg.sign_column [
53+
"highlight SignColumn guibg=none"
54+
"highlight SignColumn ctermbg=none"
55+
]));
56+
in ''
57+
vim.cmd([[
58+
${vim_cmds}
59+
]])
60+
'';
3161
};
32-
programs.nixvim.colorschemes.base16.enable = true;
3362
}
3463
);
3564
}

0 commit comments

Comments
 (0)