refactor(scripts): migrate minimal_init also to use vim.system

This commit is contained in:
Oleksandr Smirnov 2025-02-27 21:31:12 +02:00
parent 915edb6b98
commit 4e4698ae7a
No known key found for this signature in database

View file

@ -8,14 +8,15 @@ local function install_plug(plugin)
local package_root = root ".tests/site/pack/deps/start/" local package_root = root ".tests/site/pack/deps/start/"
if not vim.uv.fs_stat(package_root .. name) then if not vim.uv.fs_stat(package_root .. name) then
print("Installing " .. plugin) print("Installing " .. plugin)
vim.fn.mkdir(package_root, "p") vim
vim.fn.system { .system({
"git", "git",
"clone", "clone",
"--depth=1", "--depth=1",
"https://github.com/" .. plugin .. ".git", "https://github.com/" .. plugin .. ".git",
package_root .. "/" .. name, package_root .. "/" .. name,
} }, { text = true })
:wait()
end end
end end
@ -24,18 +25,20 @@ vim.env.XDG_DATA_HOME = root ".tests/data"
vim.env.XDG_STATE_HOME = root ".tests/state" vim.env.XDG_STATE_HOME = root ".tests/state"
vim.env.XDG_CACHE_HOME = root ".tests/cache" vim.env.XDG_CACHE_HOME = root ".tests/cache"
install_plug "nvim-treesitter/nvim-treesitter"
install_plug "echasnovski/mini.doc" -- used for docs generation
install_plug "echasnovski/mini.test"
vim.cmd [[set runtimepath=$VIMRUNTIME]] vim.cmd [[set runtimepath=$VIMRUNTIME]]
vim.opt.runtimepath:append(root()) vim.opt.runtimepath:append(root())
vim.opt.packpath = { root ".tests/site" } vim.opt.packpath = { root ".tests/site" }
vim.notify = vim.print vim.notify = vim.print
install_plug "nvim-treesitter/nvim-treesitter"
install_plug "echasnovski/mini.doc" -- used for docs generation
install_plug "echasnovski/mini.test"
-- install go treesitter parse -- install go treesitter parse
require("nvim-treesitter.install").ensure_installed_sync "go" require("nvim-treesitter.install").ensure_installed_sync "go"
-- setup mini.test only when running headless nvim
if #vim.api.nvim_list_uis() == 0 then
require("mini.test").setup { require("mini.test").setup {
collect = { collect = {
find_files = function() find_files = function()
@ -43,7 +46,4 @@ require("mini.test").setup {
end, end,
}, },
} }
end
vim.print "--- mini start"
vim.print(vim.system({ "echo", "hello" }):wait().stdout)
vim.print "--- mini end "