Skip to content

Commit 8c0bdb1

Browse files
committed
plugins/neogit: switch to mkNeovimPlugin
1 parent be87309 commit 8c0bdb1

File tree

5 files changed

+790
-244
lines changed

5 files changed

+790
-244
lines changed

plugins/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
./git/gitlinker.nix
4444
./git/gitmessenger.nix
4545
./git/gitsigns.nix
46-
./git/neogit.nix
46+
./git/neogit
4747

4848
./languages/clangd-extensions.nix
4949
./languages/debugprint.nix

plugins/git/neogit.nix

Lines changed: 0 additions & 243 deletions
This file was deleted.

plugins/git/neogit/default.nix

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
{
2+
lib,
3+
helpers,
4+
config,
5+
pkgs,
6+
...
7+
}:
8+
with lib;
9+
helpers.neovim-plugin.mkNeovimPlugin config {
10+
name = "neogit";
11+
defaultPackage = pkgs.vimPlugins.neogit;
12+
extraPackages = [pkgs.git];
13+
14+
maintainers = [maintainers.GaetanLepage];
15+
16+
# TODO introduced 2024-02-29: remove 2024-04-29
17+
deprecateExtraOptions = true;
18+
imports =
19+
map (
20+
optionPath:
21+
mkRemovedOptionModule
22+
(["plugins" "neogit"] ++ optionPath)
23+
"This option has been removed upstream. Please refer to the plugin documentation to update your configuration."
24+
)
25+
[
26+
["disableCommitConfirmation"]
27+
["disableBuiltinNotifications"]
28+
["useMagitKeybindings "]
29+
["commitPopup"]
30+
["sections" "unmerged"]
31+
["sections" "unpulled"]
32+
];
33+
optionsRenamedToSettings = [
34+
"disableSigns"
35+
"disableHint"
36+
"disableContextHighlighting"
37+
"autoRefresh"
38+
"graphStyle"
39+
"kind"
40+
"signs"
41+
"integrations"
42+
["sections" "untracked"]
43+
["sections" "unstaged"]
44+
["sections" "staged"]
45+
["sections" "stashes"]
46+
["sections" "recent"]
47+
"mappings"
48+
];
49+
50+
settingsOptions = import ./options.nix {inherit lib helpers;};
51+
52+
settingsExample = {
53+
kind = "floating";
54+
commit_popup.kind = "floating";
55+
preview_buffer.kind = "floating";
56+
popup.kind = "floating";
57+
integrations.diffview = false;
58+
disable_commit_confirmation = true;
59+
disable_builtin_notifications = true;
60+
sections = {
61+
untracked.folded = false;
62+
unstaged.folded = false;
63+
staged.folded = false;
64+
stashes.folded = false;
65+
unpulled.folded = false;
66+
unmerged.folded = true;
67+
recent.folded = true;
68+
};
69+
mappings = {
70+
status = {
71+
l = "Toggle";
72+
a = "Stage";
73+
};
74+
};
75+
};
76+
77+
extraConfig = cfg: {
78+
assertions =
79+
map
80+
(
81+
name: {
82+
assertion = let
83+
enabled = cfg.settings.integrations.${name};
84+
isEnabled = (isBool enabled) && enabled;
85+
in
86+
isEnabled
87+
-> config.plugins.${name}.enable;
88+
message = ''
89+
Nixvim (plugins.neogit): You have enabled the `${name}` integration, but `plugins.${name}.enable` is `false`.
90+
'';
91+
}
92+
)
93+
[
94+
"telescope"
95+
"diffview"
96+
"fzf-lua"
97+
];
98+
99+
extraPackages =
100+
optional
101+
(hasInfix "which" (cfg.settings.commit_view.verify_commit.__raw or ""))
102+
pkgs.which;
103+
};
104+
}

0 commit comments

Comments
 (0)