File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11--- @param name string
2+ --- @param optional ? boolean
23--- @return string
3- local function get_path (name )
4+ local function get_path (name , optional )
45 local paths = vim .fs .find (name , { path = vim .fn .stdpath (' data' ) })
5- assert (# paths == 1 , ' plugin must have one path' )
6+ if not optional then
7+ assert (# paths == 1 , ' plugin must have one path' )
8+ end
69 return paths [1 ]
710end
811
12+ --- @param names string[]
13+ --- @return string
14+ local function get_first_path (names )
15+ for _ , name in ipairs (names ) do
16+ local path = get_path (name , true )
17+ if path then
18+ return path
19+ end
20+ end
21+ error (table.concat (names , ' or ' ) .. ' must be installed' )
22+ end
23+
924-- settings
1025vim .o .columns = 80
1126vim .o .lines = 40
@@ -15,7 +30,7 @@ vim.o.wrap = false
1530-- source dependencies first
1631vim .opt .rtp :prepend (get_path (' nvim-treesitter' ))
1732vim .cmd .runtime (' plugin/nvim-treesitter.lua' )
18- vim .opt .rtp :prepend (get_path ( ' mini.nvim' ))
33+ vim .opt .rtp :prepend (get_first_path ({ ' mini.icons ' , ' mini. nvim' } ))
1934
2035-- source this plugin
2136vim .opt .rtp :prepend (' .' )
You can’t perform that action at this time.
0 commit comments