Skip to content

Commit e908e34

Browse files
committed
treewide: use boolean comparison to simplify the code base
1 parent 5066c71 commit e908e34

File tree

18 files changed

+29
-64
lines changed

18 files changed

+29
-64
lines changed

plugins/by-name/blink-cmp-copilot/default.nix

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,17 @@ lib.nixvim.plugins.mkNeovimPlugin {
4848
warnings =
4949
let
5050
copilot-lua-cfg = config.plugins.copilot-lua.settings;
51-
isEnabled = b: builtins.isBool b && b;
5251
in
5352
lib.nixvim.mkWarnings "plugins.blink-cmp-copilot" [
5453
{
55-
when = isEnabled copilot-lua-cfg.suggestion.enabled;
54+
when = copilot-lua-cfg.suggestion.enabled == true;
5655
message = ''
5756
It is recommended to disable copilot's `suggestion` module, as it can interfere with
5857
completions properly appearing in blink-cmp-copilot.
5958
'';
6059
}
6160
{
62-
when = isEnabled copilot-lua-cfg.panel.enabled;
61+
when = copilot-lua-cfg.panel.enabled == true;
6362
message = ''
6463
It is recommended to disable copilot's `panel` module, as it can interfere with completions
6564
properly appearing in blink-cmp-copilot.

plugins/by-name/copilot-cmp/default.nix

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,17 @@ lib.nixvim.plugins.mkNeovimPlugin {
5858
warnings =
5959
let
6060
copilot-lua-cfg = config.plugins.copilot-lua.settings;
61-
isEnabled = b: (lib.isBool b && b);
6261
in
6362
lib.nixvim.mkWarnings "plugins.copilot-cmp" [
6463
{
65-
when = isEnabled copilot-lua-cfg.suggestion.enabled;
64+
when = copilot-lua-cfg.suggestion.enabled == true;
6665
message = ''
6766
It is recommended to disable copilot's `suggestion` module, as it can interfere with
6867
completions properly appearing in copilot-cmp.
6968
'';
7069
}
7170
{
72-
when = isEnabled copilot-lua-cfg.panel.enabled;
71+
when = copilot-lua-cfg.panel.enabled == true;
7372
message = ''
7473
It is recommended to disable copilot's `panel` module, as it can interfere with completions
7574
properly appearing in copilot-cmp.

plugins/by-name/fidget/default.nix

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -471,10 +471,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
471471

472472
extraConfig = cfg: {
473473
warnings = lib.nixvim.mkWarnings "plugins.fidget" {
474-
when =
475-
(builtins.isBool cfg.settings.integration.nvim-tree.enable)
476-
&& cfg.settings.integration.nvim-tree.enable
477-
&& !config.plugins.nvim-tree.enable;
474+
when = (cfg.settings.integration.nvim-tree.enable == true) && !config.plugins.nvim-tree.enable;
478475

479476
message = ''
480477
You have set `plugins.fidget.settings.integrations.nvim-tree.enable` to true but have not enabled `plugins.nvim-tree`.

plugins/by-name/flutter-tools/default.nix

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
2222
warnings = lib.nixvim.mkWarnings "plugins.flutter-tools" {
2323
when =
2424
(cfg.settings ? debugger.enable)
25-
&& (lib.isBool cfg.settings.debugger.enable)
26-
&& cfg.settings.debugger.enable
25+
&& (cfg.settings.debugger.enable == true)
2726
&& (!config.plugins.dap.enable);
2827

2928
message = ''

plugins/by-name/gitsigns/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
104104

105105
extraConfig = cfg: {
106106
warnings = lib.nixvim.mkWarnings "plugins.gitsigns" {
107-
when = (lib.isBool cfg.settings.trouble && cfg.settings.trouble) && !config.plugins.trouble.enable;
107+
when = (cfg.settings.trouble == true) && !config.plugins.trouble.enable;
108108

109109
message = ''
110110
You have enabled `plugins.gitsigns.settings.trouble` but `plugins.trouble.enable` is `false`.

plugins/by-name/glance/default.nix

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
1919
warnings = lib.nixvim.mkWarnings "plugins.glance" {
2020
when =
2121
cfg.settings ? use_trouble_qf
22-
&& builtins.isBool cfg.settings.use_trouble_qf
23-
&& cfg.settings.use_trouble_qf
22+
&& (cfg.settings.use_trouble_qf == true)
2423
&& !config.plugins.trouble.enable;
2524

2625
message = ''

plugins/by-name/lazydev/default.nix

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -137,24 +137,15 @@ lib.nixvim.plugins.mkNeovimPlugin {
137137
extraConfig = cfg: {
138138
warnings = lib.nixvim.mkWarnings "plugins.lazydev" [
139139
{
140-
when =
141-
builtins.isBool cfg.settings.integrations.cmp
142-
&& !config.plugins.cmp.enable
143-
&& cfg.settings.integrations.cmp;
140+
when = (cfg.settings.integrations.cmp == true) && !config.plugins.cmp.enable;
144141
message = "You have enabled nvim-cmp integration but plugins.cmp is not enabled.";
145142
}
146143
{
147-
when =
148-
builtins.isBool cfg.settings.integrations.lspconfig
149-
&& !config.plugins.lsp.enable
150-
&& cfg.settings.integrations.lspconfig;
144+
when = (cfg.settings.integrations.lspconfig == true) && !config.plugins.lsp.enable;
151145
message = "You have enabled lspconfig integration but plugins.lsp is not enabled.";
152146
}
153147
{
154-
when =
155-
builtins.isBool cfg.settings.integrations.coq
156-
&& !config.plugins.coq-nvim.enable
157-
&& cfg.settings.integrations.coq;
148+
when = (cfg.settings.integrations.coq == true) && !config.plugins.coq-nvim.enable;
158149
message = "You have enabled coq integration but plugins.coq-nvim is not enabled.";
159150
}
160151
];

plugins/by-name/lean/default.nix

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,8 @@ in
236236
!(
237237
# leanls lsp server is disabled in nvim-lspconfig
238238
config.plugins.lsp.servers.leanls.enable
239-
# lsp is not (!) disabled in the lean.nvim plugin
240-
&& !(
241-
# lsp is explicitly set to `false`.
242-
(isBool cfg.lsp.enable) && !cfg.lsp.enable
243-
)
239+
# lsp is not explicitly disabled in the lean.nvim plugin
240+
&& (cfg.lsp.enable != false)
244241
);
245242
message = ''
246243
You have not explicitly set `plugins.lean.lsp` to `false` while having `plugins.lsp.servers.leanls.enable` set to `true`.

plugins/by-name/lir/default.nix

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
2222
warnings = lib.nixvim.mkWarnings "plugins.lir" {
2323
when =
2424
(cfg.settings ? devicons.enable)
25-
&& (lib.isBool cfg.settings.devicons.enable)
26-
&& cfg.settings.devicons.enable
25+
&& (cfg.settings.devicons.enable == true)
2726
&& (!config.plugins.web-devicons.enable);
2827

2928
message = ''

plugins/by-name/lspsaga/default.nix

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -469,9 +469,7 @@ in
469469
};
470470
warnings = lib.nixvim.mkWarnings "plugins.ltex-extra" {
471471
# https://nvimdev.github.io/lspsaga/implement/#default-options
472-
when =
473-
(isBool cfg.implement.enable && cfg.implement.enable)
474-
&& (isBool cfg.symbolInWinbar.enable && !cfg.symbolInWinbar.enable);
472+
when = (cfg.implement.enable == true) && (cfg.symbolInWinbar.enable == false);
475473

476474
message = ''
477475
You have enabled the `implement` module but it requires `symbolInWinbar` to be enabled.

0 commit comments

Comments
 (0)