Skip to content
Open
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
21 changes: 18 additions & 3 deletions tests/minimal_init.lua
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
---@param name string
---@param optional? boolean
---@return string
local function get_path(name)
local function get_path(name, optional)
local paths = vim.fs.find(name, { path = vim.fn.stdpath('data') })
assert(#paths == 1, 'plugin must have one path')
if not optional then
assert(#paths == 1, 'plugin must have one path')
end
return paths[1]
end

---@param names string[]
---@return string
local function get_first_path(names)
for _, name in ipairs(names) do
local path = get_path(name, true)
if path then
return path
end
end
error(table.concat(names, ' or ') .. ' must be installed')
end

-- settings
vim.o.columns = 80
vim.o.lines = 40
Expand All @@ -15,7 +30,7 @@ vim.o.wrap = false
-- source dependencies first
vim.opt.rtp:prepend(get_path('nvim-treesitter'))
vim.cmd.runtime('plugin/nvim-treesitter.lua')
vim.opt.rtp:prepend(get_path('mini.nvim'))
vim.opt.rtp:prepend(get_first_path({ 'mini.icons', 'mini.nvim' }))

-- source this plugin
vim.opt.rtp:prepend('.')
Expand Down