plugin_mgmt.lua 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. ---@class PluginConfig
  2. ---@field disable boolean Mark a plugin as inactive
  3. ---@field as string Specifies an alias under which to install the plugin
  4. ---@field installer function Specifies custom installer. See "custom installers" below.
  5. ---@field updater function Specifies custom updater. See "custom installers" below.
  6. ---@field after string | table Specifies plugins to load before this plugin. See "sequencing" below
  7. ---@field rtp string Specifies a subdirectory of the plugin to add to runtimepath.
  8. ---@field opt boolean Manually marks a plugin as optional.
  9. ---@field bufread boolean Manually specifying if a plugin needs BufRead after being loaded
  10. ---@field branch string Specifies a git branch to use
  11. ---@field tag string Specifies a git tag to use. Supports '*' for "latest tag"
  12. ---@field commit string Specifies a git commit to use
  13. ---@field lock boolean Skip updating this plugin in updates/syncs. Still cleans.
  14. ---@field run string Post-update/install hook. See "update/install hooks".
  15. ---@field requires string | table Specifies plugin dependencies. See "dependencies".
  16. ---@field rocks string | table Specifies Luarocks dependencies for the plugin
  17. ---@field config string | function Specifies code to run after this plugin is loaded.
  18. ---@field setup string | function Specifies code to run before this plugin is loaded. The code is ran even if the plugin is waiting for other conditions (ft, cond...) to be met. Implies opt = true
  19. ---@field cmd string | table Specifies commands which load this plugin. Can be an autocmd pattern. Imply lazy-loading and imply opt = true.
  20. ---@field ft string | table Specifies filetypes which load this plugin. Imply lazy-loading and imply opt = true.
  21. ---@field keys string | table Specifies maps which load this plugin. See "Keybindings". imply lazy-loading and imply opt = true.
  22. ---@field event string | table Specifies autocommand events which load this plugin. Imply lazy-loading and imply opt = true.
  23. ---@field fn string | table -- Specifies functions which load this plugin. Imply lazy-loading and imply opt = true.
  24. ---@field cond string Specifies a conditional test to load this plugin. Imply lazy-loading and imply opt = true.
  25. ---@field module string | table -- Specifies Lua module names for require. When requiring a string which starts with one of these module names, the plugin will be loaded. Imply lazy-loading and imply opt = true.
  26. ---@field module_pattern string | table -- Specifies Lua pattern of Lua module names for require. When requiring a string which matches one of these patterns, the plugin will be loaded. Imply lazy-loading and imply opt = true.
  27. --- Adds plugin to install and setup
  28. --- @param plugin_config PluginConfig
  29. ncvim.plugin = function(plugin_config)
  30. table.insert(ncvim.plugins, plugin_config)
  31. end
  32. --- Installs plugins and does configuration with packer
  33. ncvim.install_plugins = function()
  34. for _, plugin in ipairs(ncvim.plugins) do
  35. require('packer').use(plugin)
  36. end
  37. end