A simple plugin manager for the (lite text editor)[https://github.com/rxi/lite]. Specifically designed for use with the Project Module feature of lite, it enables you to only load certain projects instead of all plugins inside the plugins folder.
You can use git clone https://github.com/doczi-dominik/lite-plugin-manager
or use wget
to download the raw file.
By default, all plugins that are shipped with lite are enabled, except the language plugins.
Search for the line
local got_plugin_error = not core.load_plugins()
and change it to
local got_plugin_error = false
You can also delete or comment out the core.load_plugins()
function.
local plugin_m = require "plugins.plugin_manager"
This will initialize the plugin list with the values set in the lua file.
plugin_m.enable("plugin1")
plugin_m.enable("plugin2")
-- OR
plugin_m.enable({
"plugin1",
"plugin2"
})
plugin_m.disable("plugin3")
plugin_m.disable("plugin4")
-- OR
plugin_m.disable({
"plugin3",
"plugin4"
})
plugin_m.enabled = {
"plugin5",
"plugin6",
"plugin7"
}
Provide plugin names without the .lua
extension and the plugins folder prefix. For example, to access data/plugins/languages_sh.lua
, simply use languages_sh
.
plugin_m.load_plugins()
If a directory contains a .lite_project.lua
file, lite executes it after the User Module. This is where the manager shines the most, as you can use language and/or project-specific plugins instead of having to load the Golang, Lua and C++ modules for your shell scripts folder.
You can do this manually, or use the Command Finder and select Core: Open Project Module
.
local plugin_m = require "plugins.plugin_m"
plugin_m.disable("language_lua")
plugin_m.enable({
"golang",
"gofmt"
})
plugin_m.load_plugins()
You can also use project manager to inject plugins while in the editor. To do so, open the Command Finder and select Plugin Manager: Inject Plugin
. Type you want to load in the menu that pops up.
Furthermore, you can inject all plugins (enabled or disabled) by using Plugin Manager: Inject All Plugins
in the Command Finder