Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .luarc.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"diagnostics": {
"globals": [
"dofile"
"dofile",
"MiniTest"
]
},
"workspace": {
"library": [
"$VIMRUNTIME",
"deps/mini.nvim"
"deps/pack/testing/start/mini.nvim"
]
}
}
42 changes: 34 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,41 @@
DEPS_DIR := $(CURDIR)/deps
START_DIR := $(DEPS_DIR)/pack/testing/start

.PHONY: test deps

# Download mini.nvim if not present, then run all tests
test: deps
nvim --headless -u tests/scripts/minimal_init.lua -c "lua MiniTest.run()"

# Clone mini.nvim into deps/
deps:
@if [ ! -d "$(DEPS_DIR)/mini.nvim" ]; then \
echo "Downloading mini.nvim..."; \
mkdir -p "$(DEPS_DIR)"; \
git clone --depth 1 https://github.com/echasnovski/mini.nvim "$(DEPS_DIR)/mini.nvim"; \
fi
deps: \
$(START_DIR)/mini.nvim \
$(START_DIR)/vim-fugitive \
$(START_DIR)/fyler.nvim \
$(START_DIR)/trouble.nvim \
$(START_DIR)/neotest \
$(START_DIR)/nvim-nio \
$(START_DIR)/plenary.nvim \
$(START_DIR)/fixcursorhold

$(START_DIR)/mini.nvim:
git clone --depth 1 https://github.com/echasnovski/mini.nvim $@

$(START_DIR)/vim-fugitive:
git clone --depth 1 https://github.com/tpope/vim-fugitive $@

$(START_DIR)/fyler.nvim:
git clone --depth 1 https://github.com/A7Lavinraj/fyler.nvim $@

$(START_DIR)/trouble.nvim:
git clone --depth 1 https://github.com/folke/trouble.nvim $@

$(START_DIR)/neotest:
git clone --depth 1 https://github.com/nvim-neotest/neotest $@

$(START_DIR)/nvim-nio:
git clone --depth 1 https://github.com/nvim-neotest/nvim-nio $@

$(START_DIR)/plenary.nvim:
git clone --depth 1 https://github.com/nvim-lua/plenary.nvim $@

$(START_DIR)/fixcursorhold:
Comment on lines +19 to +40

Copilot AI Apr 16, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The git clone ... $@ targets assume $(START_DIR) already exists. On a fresh checkout deps/pack/testing/start won't exist, so git clone will fail because parent directories are missing. Add a mkdir -p $(START_DIR) step (e.g., an order-only prerequisite or a dedicated directory target) before cloning.

Suggested change
$(START_DIR)/mini.nvim:
git clone --depth 1 https://github.com/echasnovski/mini.nvim $@
$(START_DIR)/vim-fugitive:
git clone --depth 1 https://github.com/tpope/vim-fugitive $@
$(START_DIR)/fyler.nvim:
git clone --depth 1 https://github.com/A7Lavinraj/fyler.nvim $@
$(START_DIR)/trouble.nvim:
git clone --depth 1 https://github.com/folke/trouble.nvim $@
$(START_DIR)/neotest:
git clone --depth 1 https://github.com/nvim-neotest/neotest $@
$(START_DIR)/nvim-nio:
git clone --depth 1 https://github.com/nvim-neotest/nvim-nio $@
$(START_DIR)/plenary.nvim:
git clone --depth 1 https://github.com/nvim-lua/plenary.nvim $@
$(START_DIR)/fixcursorhold:
$(START_DIR):
mkdir -p $@
$(START_DIR)/mini.nvim: | $(START_DIR)
git clone --depth 1 https://github.com/echasnovski/mini.nvim $@
$(START_DIR)/vim-fugitive: | $(START_DIR)
git clone --depth 1 https://github.com/tpope/vim-fugitive $@
$(START_DIR)/fyler.nvim: | $(START_DIR)
git clone --depth 1 https://github.com/A7Lavinraj/fyler.nvim $@
$(START_DIR)/trouble.nvim: | $(START_DIR)
git clone --depth 1 https://github.com/folke/trouble.nvim $@
$(START_DIR)/neotest: | $(START_DIR)
git clone --depth 1 https://github.com/nvim-neotest/neotest $@
$(START_DIR)/nvim-nio: | $(START_DIR)
git clone --depth 1 https://github.com/nvim-neotest/nvim-nio $@
$(START_DIR)/plenary.nvim: | $(START_DIR)
git clone --depth 1 https://github.com/nvim-lua/plenary.nvim $@
$(START_DIR)/fixcursorhold: | $(START_DIR)

Copilot uses AI. Check for mistakes.
git clone --depth 1 https://github.com/antoinemadec/FixCursorHold.nvim $@
2 changes: 1 addition & 1 deletion lua/zen/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ local function is_buff_integration(buf)
if filetype == "zen-left" or filetype == "zen-right" then
return true
end
for _, position in ipairs({ "left", "right" }) do
for _, position in ipairs({ "left", "right", "top", "bottom" }) do
for _, integration in ipairs(opts[position] or {}) do
---@diagnostic disable-next-line: undefined-field
if type(integration) == "table" and is_filetype(filetype, integration.filetype) then
Expand Down
20 changes: 18 additions & 2 deletions tests/scripts/init_with_zen.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
vim.cmd([[let &rtp.=','.getcwd()]])
vim.cmd("set rtp+=deps/mini.nvim")
vim.opt.packpath:prepend("deps")

vim.o.columns = 240
vim.o.lines = 52

require("mini.test").setup()
require("zen").setup()
require("trouble").setup({ open_no_results = true })
require("zen").setup({
Comment on lines 1 to +9

Copilot AI Apr 16, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue as minimal_init.lua: after prepending packpath, this script immediately requires mini.test, trouble, and zen. If start packages under deps/pack/*/start/* are not loaded into runtimepath yet, these require calls will fail. Add an explicit :packloadall/packadd after setting packpath, or restore runtimepath manipulation for the needed plugins.

Copilot uses AI. Check for mistakes.
top = {
{ filetype = "fugitive" },
},
bottom = {
{ filetype = "trouble" },
},
left = {
min_width = 46,
{ filetype = "fyler" },
},
right = {
min_width = 46,
{ filetype = "neotest-summary" },
},
})
2 changes: 1 addition & 1 deletion tests/scripts/minimal_init.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
vim.cmd([[let &rtp.=','.getcwd()]])
vim.cmd("set rtp+=deps/mini.nvim")
vim.opt.packpath:prepend("deps")

Copilot AI Apr 16, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vim.opt.packpath:prepend('deps') does not by itself ensure start packages under deps/pack/*/start/* are added to runtimepath before the subsequent require('mini.test') runs. On a clean environment this can make require('mini.test') fail because mini.nvim hasn't been loaded yet. Consider either (a) calling :packloadall (or :packadd mini.nvim) after adjusting packpath and before the require, or (b) directly prepending the mini.nvim path to runtimepath as before.

Suggested change
vim.opt.packpath:prepend("deps")
vim.opt.packpath:prepend("deps")
vim.cmd([[packadd mini.nvim]])

Copilot uses AI. Check for mistakes.

require("mini.test").setup()
146 changes: 146 additions & 0 deletions tests/test_resizing.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
local Helpers = dofile("tests/scripts/helpers.lua")
local child = MiniTest.new_child_neovim()

local T = MiniTest.new_set({
hooks = {
pre_case = function()
child.restart({ "-u", "tests/scripts/init_with_zen.lua" })
end,
post_once = child.stop,
},
})

T["resizing below minimum width closes the side buffers"] = function()
child.cmd("set columns-=100")
child.cmd("doautocmd VimResized")

Helpers.expect.layout(child, {
type = "leaf",
filetype = "",
buftype = "",
width = 140,
height = 50,
})
end

T["resizing above minimum width reopens the side buffers"] = function()
child.cmd("set columns-=100")
child.cmd("doautocmd VimResized")

child.cmd("set columns+=100")
child.cmd("doautocmd VimResized")

Helpers.expect.layout(child, {
type = "row",
children = {
{ type = "leaf", filetype = "zen-left", buftype = "nofile", width = 46, height = 50 },
{ type = "leaf", filetype = "", buftype = "", width = 146, height = 50 },
{ type = "leaf", filetype = "zen-right", buftype = "nofile", width = 46, height = 50 },
},
})
end

T["with top integration"] = MiniTest.new_set({})

T["with top integration"]["resizing below minimum width closes the side buffers"] = function()
child.cmd("Git")

child.cmd("set columns-=100")
child.cmd("doautocmd VimResized")

Helpers.expect.layout(child, {
type = "col",
children = {
{ type = "leaf", filetype = "fugitive", buftype = "nowrite", width = 140, height = 25 },
{ type = "leaf", filetype = "", buftype = "", width = 140, height = 24 },
},
})
end

T["with top integration"]["resizing above minimum width reopens the side buffers"] = function()
child.cmd("Git")

child.cmd("set columns-=100")
child.cmd("doautocmd VimResized")

child.cmd("set columns+=100")
child.cmd("doautocmd VimResized")

Helpers.expect.layout(child, {
type = "col",
children = {
{ type = "leaf", filetype = "fugitive", buftype = "nowrite", width = 240, height = 25 },
{
type = "row",
children = {
{ type = "leaf", filetype = "zen-left", buftype = "nofile", width = 46, height = 24 },
{ type = "leaf", filetype = "", buftype = "", width = 146, height = 24 },
{ type = "leaf", filetype = "zen-right", buftype = "nofile", width = 46, height = 24 },
},
},
},
})
end

T["with bottom integration"] = MiniTest.new_set({})

T["with bottom integration"]["resizing below minimum width closes the side buffers"] = function()
child.cmd("Trouble diagnostics")

child.cmd("set columns-=100")
child.cmd("doautocmd VimResized")

Helpers.expect.layout(child, {
type = "col",
children = {
{ type = "leaf", filetype = "", buftype = "", width = 140, height = 39 },
{ type = "leaf", filetype = "trouble", buftype = "nofile", width = 140, height = 10 },
},
})
end

T["with bottom integration"]["resizing above minimum width reopens the side buffers"] = function()
child.cmd("Trouble diagnostics")

child.cmd("set columns-=100")
child.cmd("doautocmd VimResized")

child.cmd("set columns+=100")
child.cmd("doautocmd VimResized")

Helpers.expect.layout(child, {
type = "col",
children = {
{
type = "row",
children = {
{ type = "leaf", filetype = "zen-left", buftype = "nofile", width = 46, height = 39 },
{ type = "leaf", filetype = "", buftype = "", width = 146, height = 39 },
{ type = "leaf", filetype = "zen-right", buftype = "nofile", width = 46, height = 39 },
},
},
{ type = "leaf", filetype = "trouble", buftype = "nofile", width = 240, height = 10 },
},
})
end

T["with top and bottom integration"] = MiniTest.new_set({})

T["with top and bottom integration"]["resizing below minimum width closes the side buffers"] = function()
child.cmd("Git")
child.cmd("Trouble diagnostics")

child.cmd("set columns-=100")
child.cmd("doautocmd VimResized")

Helpers.expect.layout(child, {
type = "col",
children = {
{ type = "leaf", filetype = "fugitive", buftype = "nowrite", width = 140, height = 25 },
{ type = "leaf", filetype = "", buftype = "", width = 140, height = 13 },
{ type = "leaf", filetype = "trouble", buftype = "nofile", width = 140, height = 10 },
},
})
end

return T
Loading