Skip to content

Commit c277df8

Browse files
authored
fix: fugitive create commit (#11)
1 parent 9e9a830 commit c277df8

3 files changed

Lines changed: 223 additions & 1 deletion

File tree

Makefile

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@ deps: \
1414
$(START_DIR)/neotest \
1515
$(START_DIR)/nvim-nio \
1616
$(START_DIR)/plenary.nvim \
17-
$(START_DIR)/fixcursorhold
17+
$(START_DIR)/fixcursorhold \
18+
$(START_DIR)/vim-dadbod \
19+
$(START_DIR)/vim-dadbod-ui \
20+
$(START_DIR)/nvim-dap \
21+
$(START_DIR)/nvim-dap-ui \
22+
$(START_DIR)/CopilotChat.nvim
1823

1924
$(START_DIR)/mini.nvim:
2025
git clone --depth 1 https://github.com/echasnovski/mini.nvim $@
@@ -39,3 +44,18 @@ $(START_DIR)/plenary.nvim:
3944

4045
$(START_DIR)/fixcursorhold:
4146
git clone --depth 1 https://github.com/antoinemadec/FixCursorHold.nvim $@
47+
48+
$(START_DIR)/vim-dadbod:
49+
git clone --depth 1 https://github.com/tpope/vim-dadbod $@
50+
51+
$(START_DIR)/vim-dadbod-ui:
52+
git clone --depth 1 https://github.com/kristijanhusak/vim-dadbod-ui $@
53+
54+
$(START_DIR)/nvim-dap:
55+
git clone --depth 1 https://github.com/mfussenegger/nvim-dap $@
56+
57+
$(START_DIR)/nvim-dap-ui:
58+
git clone --depth 1 https://github.com/rcarriga/nvim-dap-ui $@
59+
60+
$(START_DIR)/CopilotChat.nvim:
61+
git clone --depth 1 https://github.com/CopilotC-Nvim/CopilotChat.nvim $@

tests/scripts/init_with_zen.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,26 @@ require("mini.test").setup()
88
require("trouble").setup({ open_no_results = true })
99
require("fyler").setup({})
1010
require("neotest").setup({ adapters = {} })
11+
require("dapui").setup({})
12+
require("CopilotChat").setup({})
1113
require("zen").setup({
1214
top = {
1315
{ filetype = "fugitive" },
16+
{ filetype = "man" },
1417
},
1518
bottom = {
1619
{ filetype = "trouble" },
20+
{ filetype = "qf" },
1721
},
1822
left = {
1923
min_width = 46,
2024
{ filetype = "fyler" },
25+
{ filetype = "dbui" },
2126
},
2227
right = {
2328
min_width = 46,
2429
{ filetype = "neotest-summary" },
30+
{ filetype = "copilot-chat" },
31+
{ filetype = { "dapui_watches", "dapui_scopes", "dapui_stacks", "dapui_breakpoints" } },
2532
},
2633
})

tests/test_integrations.lua

Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,145 @@ T["left integration"]["opening closes zen side buffer, closing reopens it"] = fu
3636
})
3737
end
3838

39+
40+
T["left integration"]["opening an integration should close the existing integration on the same side"] = function()
41+
child.cmd("Fyler kind=split_left_most")
42+
43+
Helpers.expect.layout(child, {
44+
type = "row",
45+
children = {
46+
{ type = "leaf", filetype = "fyler", buftype = "acwrite", width = 46, height = 50 },
47+
{ type = "leaf", filetype = "", buftype = "", width = 146, height = 50 },
48+
{ type = "leaf", filetype = "zen-right", buftype = "nofile", width = 46, height = 50 },
49+
},
50+
})
51+
52+
child.cmd("DBUI")
53+
54+
Helpers.expect.layout(child, {
55+
type = "row",
56+
children = {
57+
{ type = "leaf", filetype = "dbui", buftype = "nofile", width = 46, height = 50 },
58+
{ type = "leaf", filetype = "", buftype = "", width = 146, height = 50 },
59+
{ type = "leaf", filetype = "zen-right", buftype = "nofile", width = 46, height = 50 },
60+
},
61+
})
62+
end
63+
64+
T["top integration"] = MiniTest.new_set({})
65+
66+
T["top integration"]["opening"] = function()
67+
child.cmd("Git")
68+
69+
Helpers.expect.layout(child, {
70+
type = "col",
71+
children = {
72+
{ type = "leaf", filetype = "fugitive", buftype = "nowrite", width = 240, height = 25 },
73+
{
74+
type = "row",
75+
children = {
76+
{ type = "leaf", filetype = "zen-left", buftype = "nofile", width = 46, height = 24 },
77+
{ type = "leaf", filetype = "", buftype = "", width = 146, height = 24 },
78+
{ type = "leaf", filetype = "zen-right", buftype = "nofile", width = 46, height = 24 },
79+
},
80+
},
81+
},
82+
})
83+
end
84+
85+
T["top integration"]["opening an integration should close the existing integration on the same side"] = function()
86+
child.cmd("Git")
87+
88+
Helpers.expect.layout(child, {
89+
type = "col",
90+
children = {
91+
{ type = "leaf", filetype = "fugitive", buftype = "nowrite", width = 240, height = 25 },
92+
{
93+
type = "row",
94+
children = {
95+
{ type = "leaf", filetype = "zen-left", buftype = "nofile", width = 46, height = 24 },
96+
{ type = "leaf", filetype = "", buftype = "", width = 146, height = 24 },
97+
{ type = "leaf", filetype = "zen-right", buftype = "nofile", width = 46, height = 24 },
98+
},
99+
},
100+
},
101+
})
102+
103+
child.cmd("Man ls")
104+
105+
Helpers.expect.layout(child, {
106+
type = "col",
107+
children = {
108+
{ type = "leaf", filetype = "man", buftype = "nofile", width = 240, height = 25 },
109+
{
110+
type = "row",
111+
children = {
112+
{ type = "leaf", filetype = "zen-left", buftype = "nofile", width = 46, height = 24 },
113+
{ type = "leaf", filetype = "", buftype = "", width = 146, height = 24 },
114+
{ type = "leaf", filetype = "zen-right", buftype = "nofile", width = 46, height = 24 },
115+
},
116+
},
117+
},
118+
})
119+
end
120+
121+
T["bottom integration"] = MiniTest.new_set({})
122+
123+
T["bottom integration"]["opening"] = function()
124+
child.cmd("Trouble diagnostics")
125+
126+
Helpers.expect.layout(child, {
127+
type = "col",
128+
children = {
129+
{
130+
type = "row",
131+
children = {
132+
{ type = "leaf", filetype = "zen-left", buftype = "nofile", width = 46, height = 39 },
133+
{ type = "leaf", filetype = "", buftype = "", width = 146, height = 39 },
134+
{ type = "leaf", filetype = "zen-right", buftype = "nofile", width = 46, height = 39 },
135+
},
136+
},
137+
{ type = "leaf", filetype = "trouble", buftype = "nofile", width = 240, height = 10 },
138+
},
139+
})
140+
end
141+
142+
T["bottom integration"]["opening an integration should close the existing integration on the same side"] = function()
143+
child.cmd("Trouble diagnostics")
144+
145+
Helpers.expect.layout(child, {
146+
type = "col",
147+
children = {
148+
{
149+
type = "row",
150+
children = {
151+
{ type = "leaf", filetype = "zen-left", buftype = "nofile", width = 46, height = 39 },
152+
{ type = "leaf", filetype = "", buftype = "", width = 146, height = 39 },
153+
{ type = "leaf", filetype = "zen-right", buftype = "nofile", width = 46, height = 39 },
154+
},
155+
},
156+
{ type = "leaf", filetype = "trouble", buftype = "nofile", width = 240, height = 10 },
157+
},
158+
})
159+
160+
child.cmd("copen")
161+
162+
Helpers.expect.layout(child, {
163+
type = "col",
164+
children = {
165+
{
166+
type = "row",
167+
children = {
168+
{ type = "leaf", filetype = "zen-left", buftype = "nofile", width = 46, height = 39 },
169+
{ type = "leaf", filetype = "", buftype = "", width = 146, height = 39 },
170+
{ type = "leaf", filetype = "zen-right", buftype = "nofile", width = 46, height = 39 },
171+
},
172+
},
173+
{ type = "leaf", filetype = "qf", buftype = "quickfix", width = 240, height = 10 },
174+
},
175+
})
176+
end
177+
39178
T["right integration"] = MiniTest.new_set({})
40179

41180
T["right integration"]["opening closes zen side buffer, closing reopens it"] = function()
@@ -62,4 +201,60 @@ T["right integration"]["opening closes zen side buffer, closing reopens it"] = f
62201
})
63202
end
64203

204+
T["right integration"]["opening an integration should close the existing integration on the same side"] = function()
205+
child.cmd("Neotest summary open")
206+
207+
Helpers.expect.layout(child, {
208+
type = "row",
209+
children = {
210+
{ type = "leaf", filetype = "zen-left", buftype = "nofile", width = 46, height = 50 },
211+
{ type = "leaf", filetype = "", buftype = "", width = 142, height = 50 },
212+
{ type = "leaf", filetype = "neotest-summary", buftype = "nofile", width = 50, height = 50 },
213+
},
214+
})
215+
216+
child.lua([[vim.o.splitright = true; require("CopilotChat").open()]])
217+
218+
Helpers.expect.layout(child, {
219+
type = "row",
220+
children = {
221+
{ type = "leaf", filetype = "zen-left", buftype = "nofile", width = 46, height = 50 },
222+
{ type = "leaf", filetype = "", buftype = "", width = 146, height = 50 },
223+
{ type = "leaf", filetype = "copilot-chat", buftype = "nofile", width = 46, height = 50 },
224+
},
225+
})
226+
end
227+
228+
T["right integration"]["opening an integration with table filetype"] = function()
229+
child.lua([[require("dapui").open()]])
230+
231+
Helpers.expect.layout(child, {
232+
type = "row",
233+
children = {
234+
{
235+
type = "col",
236+
children = {
237+
{ type = "leaf", filetype = "dapui_watches", buftype = "prompt", width = 40, height = 12 },
238+
{ type = "leaf", filetype = "dapui_stacks", buftype = "nofile", width = 40, height = 12 },
239+
{ type = "leaf", filetype = "dapui_breakpoints", buftype = "nofile", width = 40, height = 12 },
240+
{ type = "leaf", filetype = "dapui_scopes", buftype = "nofile", width = 40, height = 11 },
241+
},
242+
},
243+
{
244+
type = "col",
245+
children = {
246+
{ type = "leaf", filetype = "", buftype = "", width = 199, height = 39 },
247+
{
248+
type = "row",
249+
children = {
250+
{ type = "leaf", filetype = "dapui_console", buftype = "nofile", width = 99, height = 10 },
251+
{ type = "leaf", filetype = "dap-repl", buftype = "prompt", width = 99, height = 10 },
252+
},
253+
},
254+
},
255+
},
256+
},
257+
})
258+
end
259+
65260
return T

0 commit comments

Comments
 (0)