1- --- @param name string
2- --- @param optional ? boolean
3- --- @return string
4- local function get_path (name , optional )
5- local paths = vim .fs .find (name , { path = vim .fn .stdpath (' data' ) })
6- if not optional then
7- assert (# paths == 1 , ' plugin must have one path' )
8- end
9- return paths [1 ]
10- end
11-
121--- @param names string[]
132--- @return string
14- local function get_first_path (names )
3+ local function get_path (names )
154 for _ , name in ipairs (names ) do
16- local path = get_path (name , true )
17- if path then
18- return path
5+ local paths = vim . fs . find (name , { path = vim . fn . stdpath ( ' data ' ) } )
6+ if # paths == 1 then
7+ return paths [ 1 ]
198 end
209 end
2110 error (table.concat (names , ' or ' ) .. ' must be installed' )
@@ -28,16 +17,16 @@ vim.o.tabstop = 4
2817vim .o .wrap = false
2918
3019-- source dependencies first
31- vim .opt .rtp :prepend (get_path (' nvim-treesitter' ))
20+ vim .opt .rtp :prepend (get_path ({ ' nvim-treesitter' } ))
3221vim .cmd .runtime (' plugin/nvim-treesitter.lua' )
33- vim .opt .rtp :prepend (get_first_path ({ ' mini.icons ' , ' mini.nvim ' }))
22+ vim .opt .rtp :prepend (get_path ({ ' mini.nvim ' , ' mini.icons ' }))
3423
3524-- source this plugin
3625vim .opt .rtp :prepend (' .' )
3726vim .cmd .runtime (' plugin/render-markdown.lua' )
3827
3928-- used for unit testing
40- vim .opt .rtp :prepend (get_path (' plenary.nvim' ))
29+ vim .opt .rtp :prepend (get_path ({ ' plenary.nvim' } ))
4130vim .cmd .runtime (' plugin/plenary.vim' )
4231
4332require (' nvim-treesitter' )
0 commit comments