Skip to content

Commit

Permalink
add docs for wezterm.plugin module
Browse files Browse the repository at this point in the history
  • Loading branch information
MLFlexer committed Jul 23, 2024
1 parent a5a3b50 commit cfc93a2
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/config/lua/wezterm.plugin/list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# `wezterm.plugin.list()`

{{since('???')}}

Returns an array of all the plugins within the plugin directory.

The elements consists of tables with:
`url` from where the git repository is hosted.
`component`, that is the name of the local root repository root directory.
`plugin_dir` the full path to the repository root directory.

6 changes: 6 additions & 0 deletions docs/config/lua/wezterm.plugin/plugin_dir.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# `wezterm.plugin.plugin_dir()`

{{since('???')}}

Returns the path of the plugin root directory.

13 changes: 13 additions & 0 deletions docs/config/lua/wezterm.plugin/require.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# `wezterm.plugin.require()`

{{since('???')}}

Takes a `url` string as argument, which it will use to clone the git repository if not already cloned, and then require the lua files.

It will do so by making a directory based on the `url` but with `/` and `\` replaced by `sZs`, `:` replaced by `sCs` and `.` replaced by `sDs`.
It will place this directory in the plugins directory and then clone the repository into it.

It will try to require `init.lua` from the repository root or in the `plugin/` sub directory.

It is recommended to use [require_as_alias](./require_as_alias.md) instead to make it easy to require lua files via the alias instead of the modified url name.

10 changes: 10 additions & 0 deletions docs/config/lua/wezterm.plugin/require_as_alias.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# `wezterm.plugin.require_as_alias()`

{{since('???')}}

Takes a `url` string and a `alias` string as argument.

It will make a sub directory with the name of the alias in the plugins sub directory and then clone the git repository from the url into this directory.

It is assumed that the lua files are placed in a `init.lua` in the repository root or in the `plugin/` sub-directory of the repository root.

6 changes: 6 additions & 0 deletions docs/config/lua/wezterm.plugin/update_all.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# `wezterm.plugin.update_all()`

{{since('???')}}

Will update each plugin in the plugin directory, by first fetching, then merging if there are any changes.

0 comments on commit cfc93a2

Please sign in to comment.