mirror of
				https://github.com/folke/lazy.nvim.git
				synced 2025-10-31 06:21:14 +00:00 
			
		
		
		
	refactor: Loader.source_runtime
This commit is contained in:
		
					parent
					
						
							
								fc0a10150f
							
						
					
				
			
			
				commit
				
					
						39c7e21c5f
					
				
			
		
					 1 changed files with 6 additions and 6 deletions
				
			
		|  | @ -70,18 +70,18 @@ end | |||
| function M.packadd(plugin, load_start) | ||||
|   if plugin.opt then | ||||
|     vim.cmd.packadd(plugin.name) | ||||
|     M.source_plugin_files(plugin, true) | ||||
|     M.source_runtime(plugin, "/after/plugin") | ||||
|   elseif load_start then | ||||
|     vim.opt.runtimepath:append(plugin.dir) | ||||
|     M.source_plugin_files(plugin) | ||||
|     M.source_plugin_files(plugin, true) | ||||
|     M.source_runtime(plugin, "/plugin") | ||||
|     M.source_runtime(plugin, "/after/plugin") | ||||
|   end | ||||
| end | ||||
| 
 | ||||
| ---@param plugin LazyPlugin | ||||
| ---@param after? boolean | ||||
| function M.source_plugin_files(plugin, after) | ||||
|   Util.walk(plugin.dir .. (after and "/after" or "") .. "/plugin", function(path, _, t) | ||||
| ---@param dir? string | ||||
| function M.source_runtime(plugin, dir) | ||||
|   Util.walk(plugin.dir .. dir, function(path, _, t) | ||||
|     local ext = path:sub(-3) | ||||
|     if t == "file" and (ext == "lua" or ext == "vim") then | ||||
|       vim.cmd("silent source " .. path) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue