Skip to content

Commit e8f1fee

Browse files
committed
scripts: rework minimal_init.lua
1 parent 87f3c77 commit e8f1fee

File tree

2 files changed

+23
-39
lines changed

2 files changed

+23
-39
lines changed

scripts/minimal_init.lua

+16-33
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,12 @@
1-
-- this template is borrowed from nvim-lspconfig
2-
local on_windows = vim.uv.os_uname().version:match("Windows")
3-
4-
local function join_paths(...)
5-
local path_sep = on_windows and "\\" or "/"
6-
local result = table.concat({ ... }, path_sep)
7-
return result
8-
end
9-
101
vim.g.loaded_remote_plugins = ""
11-
vim.cmd([[set runtimepath=$VIMRUNTIME]])
2+
vim.o.runtimepath = vim.env["VIMRUNTIME"]
123

13-
local temp_dir = vim.env.TEMP or "/tmp"
4+
local temp_dir = vim.fs.dirname(vim.fn.tempname())
145

15-
vim.cmd("set packpath=" .. join_paths(temp_dir, "nvim", "site"))
6+
vim.o.packpath = vim.fs.joinpath(temp_dir, "nvim", "site")
167

17-
local package_root = join_paths(temp_dir, "nvim", "site", "pack")
18-
local install_path = join_paths(package_root, "packer", "start", "packer.nvim")
19-
local compile_path = join_paths(install_path, "plugin", "packer_compiled.lua")
8+
local package_root = vim.fs.joinpath(temp_dir, "nvim", "site", "pack")
9+
local install_path = vim.fs.joinpath(package_root, "deps", "start", "mini.deps")
2010

2111
local null_ls_config = function()
2212
local null_ls = require("null-ls")
@@ -29,27 +19,20 @@ end
2919

3020
local function load_plugins()
3121
-- only add other plugins if they are necessary to reproduce the issue
32-
require("packer").startup({
33-
{
34-
"wbthomason/packer.nvim",
35-
{
36-
"nvimtools/none-ls.nvim",
37-
requires = { "nvim-lua/plenary.nvim" },
38-
config = null_ls_config,
39-
},
40-
},
41-
config = {
42-
package_root = package_root,
43-
compile_path = compile_path,
22+
local deps = require("mini.deps")
23+
deps.setup({
24+
path = {
25+
package = package_root,
4426
},
4527
})
28+
deps.add({
29+
source = "nvimtools/none-ls.nvim",
30+
depends = { "nvim-lua/plenary.nvim" },
31+
})
32+
deps.later(null_ls_config)
4633
end
4734

4835
if vim.fn.isdirectory(install_path) == 0 then
49-
vim.fn.system({ "git", "clone", "https://github.com/wbthomason/packer.nvim", install_path })
50-
load_plugins()
51-
require("packer").sync()
52-
else
53-
load_plugins()
54-
require("packer").sync()
36+
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/echasnovski/mini.deps", install_path })
5537
end
38+
load_plugins()

test/minimal_init.lua

+7-6
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,22 @@ function M.load(plugin)
1616
"git",
1717
"clone",
1818
"--depth=1",
19+
"--filter=blob:none",
1920
"https://github.com/" .. plugin .. ".git",
20-
package_root .. "/" .. name,
21+
vim.fs.joinpath(package_root, name),
2122
})
2223
end
2324
end
2425

2526
function M.setup()
26-
vim.cmd([[set runtimepath=$VIMRUNTIME]])
27+
vim.o.runtimepath = vim.env["VIMRUNTIME"]
2728
vim.opt.runtimepath:append(M.root())
2829
vim.opt.packpath = { M.root(".tests/site") }
2930
M.load("nvim-lua/plenary.nvim")
30-
vim.env.XDG_CONFIG_HOME = M.root(".tests/config")
31-
vim.env.XDG_DATA_HOME = M.root(".tests/data")
32-
vim.env.XDG_STATE_HOME = M.root(".tests/state")
33-
vim.env.XDG_CACHE_HOME = M.root(".tests/cache")
31+
vim.env["XDG_CONFIG_HOME"] = M.root(".tests/config")
32+
vim.env["XDG_DATA_HOME"] = M.root(".tests/data")
33+
vim.env["XDG_STATE_HOME"] = M.root(".tests/state")
34+
vim.env["XDG_CACHE_HOME"] = M.root(".tests/cache")
3435
require("null-ls.config")._set({ log = { enable = false } })
3536
end
3637

0 commit comments

Comments
 (0)