wbthomason / packer.nvim

A use-package inspired plugin manager for Neovim. Uses native packages, supports Luarocks dependencies, written in Lua, allows for expressive config
MIT License
7.72k stars 262 forks source link

feat: use config from `_G.packer_plugins` in `packer_compiled.lua` #1096

Open younger-1 opened 1 year ago

younger-1 commented 1 year ago

Since plugins's config is in config field of _G.packer_plugins, we could use it directly if the type of config field is fnction. Otherwise, the compiled config string could be appear twice in packer_compiled.lua.

Result:

-- Config for: monokai.nvim
time([[Config for monokai.nvim]], true)
try_loadstring(_G.packer_plugins["monokai.nvim"].config[1], "config", "monokai.nvim")
time([[Config for monokai.nvim]], false)

This doesn't impact if the type of config field is string, so it works as expect.