1
1
--- @diagnostic disable : inject-field
2
- --- @class LazyMinit : LazyConfig
3
- --- @field stdpath ? string
4
2
5
3
local islist = vim .islist or vim .tbl_islist
6
4
7
- --- @alias MinitSetup (fun ( spec : LazySpec , opts : LazyMinit ): LazyMinit ?) | ( fun ( opts : LazyMinit ): LazyMinit ?) | ( fun ( spec : LazySpec , opts : LazyMinit ): LazyMinit ?)
8
-
9
5
local M = {}
10
6
11
- --- @param opts LazyMinit
7
+ --- @param opts LazyConfig
12
8
--- @return LazySpec[]
13
9
local function get_spec (opts )
14
10
local ret = opts .spec or {}
15
11
return ret and type (ret ) == " table" and islist (ret ) and ret or { ret }
16
12
end
17
13
18
- --- @param defaults LazyMinit
19
- --- @param opts LazyMinit
14
+ --- @param defaults LazyConfig
15
+ --- @param opts LazyConfig
20
16
function M .extend (defaults , opts )
21
17
local spec = {}
22
18
vim .list_extend (spec , get_spec (defaults ))
@@ -30,10 +26,11 @@ function M.setup(opts)
30
26
}, opts )
31
27
32
28
-- set stdpaths to use .tests
33
- local root = opts .stdpath or " .minit"
34
- root = vim .fn .fnamemodify (root , " :p" )
35
- for _ , name in ipairs ({ " config" , " data" , " state" , " cache" }) do
36
- vim .env [(" XDG_%s_HOME" ):format (name :upper ())] = root .. " /" .. name
29
+ if vim .env .LAZY_STDPATH then
30
+ local root = vim .fn .fnamemodify (vim .env .LAZY_STDPATH , " :p" )
31
+ for _ , name in ipairs ({ " config" , " data" , " state" , " cache" }) do
32
+ vim .env [(" XDG_%s_HOME" ):format (name :upper ())] = root .. " /" .. name
33
+ end
37
34
end
38
35
39
36
vim .o .loadplugins = true
@@ -68,7 +65,7 @@ function M.repro(opts)
68
65
M .setup (opts )
69
66
end
70
67
71
- --- @param opts LazyMinit
68
+ --- @param opts LazyConfig
72
69
function M .busted (opts )
73
70
opts = M .extend ({
74
71
spec = {
0 commit comments