1
1
mirror of https://github.com/wez/wezterm.git synced 2024-10-27 08:09:45 +03:00
wezterm/config
Wez Furlong e4ae8a844d
Add wezterm.plugin module, allows loading modules from git
Brief usage notes here:

```lua
local wezterm = require 'wezterm'
local a_plugin = wezterm.plugin.require "https://github.com/owner/repo"

local config = wezterm.config_builder()

a_plugin.apply_to_config(config)

return config
```

The referenced repo is expected to have a `plugin/init.lua` file,
and by convention, return a module that exports an `apply_to_config`
function that accepts at least a config builder parameter, but may
pass other parameters, or a lua table with a `config` field that maps
to a config build parameter.

`wezterm.plugin.require` will clone the repo if it doesn't already
exist and store it in the runtime dir under `plugins/NAME` where
`NAME` is derived from the repo URL.  Once cloned, the repo is
NOT automatically updated.

Only HTTP (or local filesystem) repos are allowed for the git URL;
we cannot currently use ssh for this due to conflicting version
requirements that I'll take a look at later.

`wezterm.plugin.require` will then perform `require "NAME"`,
and since the default `package.path` now includes the appropriate
location from the runtime dir, the module should load.

Two other functions are available:

`wezterm.plugin.list()` will list the plugin repos.

`wezterm.plugin.update_all()` will attempt to fast-forward or `pull
--rebase` each of the repos it finds. It doesn't currently do anything
proactive to reload the configuration afterwards; the user will need to
do that themselves.
2023-01-31 20:07:42 -07:00
..
derive config: derive some metadata about the config 2022-09-22 06:09:31 -07:00
src Add wezterm.plugin module, allows loading modules from git 2023-01-31 20:07:42 -07:00
build.rs colorschemes: expand to include Gogh color schemes 2022-07-10 13:32:17 -07:00
Cargo.toml Add wezterm.plugin module, allows loading modules from git 2023-01-31 20:07:42 -07:00