Skip to content

Commit 757e02a

Browse files
committed
plugins/tinygit: init
1 parent f464541 commit 757e02a

File tree

2 files changed

+247
-0
lines changed

2 files changed

+247
-0
lines changed

plugins/by-name/tinygit/default.nix

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
lib,
3+
pkgs,
4+
...
5+
}:
6+
lib.nixvim.plugins.mkNeovimPlugin {
7+
name = "tinygit";
8+
packPathName = "nvim-tinygit";
9+
package = "nvim-tinygit";
10+
11+
maintainers = [ lib.maintainers.GaetanLepage ];
12+
13+
extraOptions = {
14+
curlPackage = lib.mkPackageOption pkgs "curl" {
15+
nullable = true;
16+
};
17+
18+
gitPackage = lib.mkPackageOption pkgs "git" {
19+
nullable = true;
20+
};
21+
};
22+
23+
extraConfig = cfg: {
24+
extraPackages = [
25+
cfg.curlPackage
26+
cfg.gitPackage
27+
];
28+
};
29+
30+
settingsExample = {
31+
stage.moveToNextHunkOnStagingToggle = true;
32+
commit = {
33+
keepAbortedMsgSecs.__raw = "60 * 10";
34+
spellcheck = true;
35+
subject = {
36+
autoFormat.__raw = ''
37+
function(subject)
38+
-- remove trailing dot https://commitlint.js.org/reference/rules.html#body-full-stop
39+
subject = subject:gsub("%.$", "")
40+
41+
-- sentence case of title after the type
42+
subject = subject
43+
:gsub("^(%w+: )(.)", function(c1, c2) return c1 .. c2:lower() end) -- no scope
44+
:gsub("^(%w+%b(): )(.)", function(c1, c2) return c1 .. c2:lower() end) -- with scope
45+
return subject
46+
end
47+
'';
48+
enforceType = true;
49+
};
50+
};
51+
statusline = {
52+
blame = {
53+
hideAuthorNames = [
54+
"John Doe"
55+
"johndoe"
56+
];
57+
ignoreAuthors = [ "🤖 automated" ];
58+
maxMsgLen = 55;
59+
};
60+
};
61+
};
62+
}
Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
{
2+
empty = {
3+
plugins.tinygit.enable = true;
4+
};
5+
6+
defaults = {
7+
plugins.tinygit = {
8+
enable = true;
9+
10+
settings = {
11+
stage = {
12+
contextSize = 1;
13+
stagedIndicator = "󰐖";
14+
keymaps = {
15+
stagingToggle = "<Space>";
16+
gotoHunk = "<CR>";
17+
resetHunk = "<C-r>";
18+
};
19+
moveToNextHunkOnStagingToggle = false;
20+
telescopeOpts = {
21+
layout_strategy = "horizontal";
22+
layout_config = {
23+
horizontal = {
24+
preview_width = 0.65;
25+
height = {
26+
__unkeyed = 0.7;
27+
min = 20;
28+
};
29+
};
30+
};
31+
};
32+
};
33+
commit = {
34+
keepAbortedMsgSecs = 300;
35+
border = "rounded";
36+
spellcheck = false;
37+
wrap = "hard";
38+
keymaps = {
39+
normal = {
40+
abort = "q";
41+
confirm = "<CR>";
42+
};
43+
insert = {
44+
confirm = "<C-CR>";
45+
};
46+
};
47+
subject = {
48+
autoFormat.__raw = ''
49+
function(subject) ---@type nil|fun(subject: string): string
50+
subject = subject:gsub("%.$", "") -- remove trailing dot https://commitlint.js.org/reference/rules.html#body-full-stop
51+
return subject
52+
end
53+
'';
54+
enforceType = false;
55+
types = [
56+
"fix"
57+
"feat"
58+
"chore"
59+
"docs"
60+
"refactor"
61+
"build"
62+
"test"
63+
"perf"
64+
"style"
65+
"revert"
66+
"ci"
67+
"break"
68+
];
69+
};
70+
body = {
71+
enforce = false;
72+
};
73+
};
74+
push = {
75+
preventPushingFixupCommits = true;
76+
confirmationSound = true;
77+
openReferencedIssues = false;
78+
};
79+
github = {
80+
icons = {
81+
openIssue = "🟢";
82+
closedIssue = "🟣";
83+
notPlannedIssue = "⚪";
84+
openPR = "🟩";
85+
mergedPR = "🟪";
86+
draftPR = "⬜";
87+
closedPR = "🟥";
88+
};
89+
};
90+
history = {
91+
diffPopup = {
92+
width = 0.8;
93+
height = 0.8;
94+
border = "rounded";
95+
};
96+
autoUnshallowIfNeeded = false;
97+
};
98+
appearance = {
99+
mainIcon = "󰊢";
100+
backdrop = {
101+
enabled = true;
102+
blend = 40;
103+
};
104+
};
105+
statusline = {
106+
blame = {
107+
ignoreAuthors = [ ];
108+
hideAuthorNames = [ ];
109+
maxMsgLen = 40;
110+
icon = "ﰖ";
111+
};
112+
branchState = {
113+
icons = {
114+
ahead = "󰶣";
115+
behind = "󰶡";
116+
diverge = "󰃻";
117+
};
118+
};
119+
};
120+
};
121+
};
122+
};
123+
124+
example = {
125+
plugins.tinygit = {
126+
enable = true;
127+
128+
settings = {
129+
stage.moveToNextHunkOnStagingToggle = true;
130+
commit = {
131+
keepAbortedMsgSecs.__raw = "60 * 10";
132+
spellcheck = true;
133+
subject = {
134+
autoFormat.__raw = ''
135+
function(subject)
136+
-- remove trailing dot https://commitlint.js.org/reference/rules.html#body-full-stop
137+
subject = subject:gsub("%.$", "")
138+
139+
-- sentence case of title after the type
140+
subject = subject
141+
:gsub("^(%w+: )(.)", function(c1, c2) return c1 .. c2:lower() end) -- no scope
142+
:gsub("^(%w+%b(): )(.)", function(c1, c2) return c1 .. c2:lower() end) -- with scope
143+
return subject
144+
end
145+
'';
146+
enforceType = true;
147+
types = [
148+
"fix"
149+
"feat"
150+
"chore"
151+
"docs"
152+
"refactor"
153+
"build"
154+
"test"
155+
"perf"
156+
"style"
157+
"revert"
158+
"ci"
159+
"break"
160+
"improv"
161+
];
162+
};
163+
};
164+
push.openReferencedIssues = true;
165+
history = {
166+
autoUnshallowIfNeeded = true;
167+
diffPopup = {
168+
width = 0.9;
169+
height = 0.9;
170+
};
171+
};
172+
statusline = {
173+
blame = {
174+
hideAuthorNames = [
175+
"John Doe"
176+
"johndoe"
177+
];
178+
ignoreAuthors = [ "🤖 automated" ];
179+
maxMsgLen = 55;
180+
};
181+
};
182+
};
183+
};
184+
};
185+
}

0 commit comments

Comments
 (0)