Skip to content

Commit

Permalink
Merge pull request #235 from zellij-org/blog-link
Browse files Browse the repository at this point in the history
link to dj95's blog post
  • Loading branch information
imsnif authored May 17, 2024
2 parents 8398753 + 178cc29 commit 0a993db
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/src/plugin-lifecycle.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Since events are used for asynchronous communication between Zellij and the plug
a specific order. This means, that a plugin could receive certain events (like `ModeUpdate`) before the
`PermissionRequestResult` event is received. Therefore the plugin should ensure, that dependencies within
the plugin logic between certain events are handled correctly. An example for waiting for the `PermissionRequestResult`
can be found in the [Common Snippets](./plugin-development-common-snippets.md).
can be found in [this great plug post](https://blog.nerd.rocks/posts/common-snippets-for-zellij-development/)

### render
Will be called either after an `update` that requested it, or when the plugin otherwise needs to be re-rendered (eg. on startup, or when the plugin is resized). The `rows` and `cols` values represent the "content size" of the plugin (this will not include its surrounding frame if the user has pane frames enabled).
Expand Down
10 changes: 10 additions & 0 deletions static/documentation/plugin-aliases.html
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,16 @@ <h1 id="plugin-aliases"><a class="header" href="#plugin-aliases">Plugin Aliases<
<p>With this plugins block, whenever the bare <code>tab-bar</code> is used to refer to a plugin (be it in a <a href="./layouts.html">layout</a>, from the <a href="./zellij-plugin.html">command line</a>, from a <a href="./keybindings.html">keybinding</a> or from <a href="./plugin-pipes.html">another plugin</a>), Zellij will translate it to the internal <code>zellij:tab-bar</code> url. Whenever the bare <code>filepicker</code> url is used to refer to a plugin, Zellij will translate it to the built-in <code>zellij:strider</code> url will be used with the <code>cwd "/"</code> configuration.</p>
<p>Aliases can be added to this block or changed to swap the default built-in plugins to other implementations. Removing the default aliases entirely might cause Zellij not to function as expected.</p>
<p>When swapping the default aliases for custom plugins, it's important that these plugins implement the basic contract Zellij (and indeed, other plugins) expect of them. The following sections describe the contract for each default alias.</p>
<p>Here's an example on how to use the plugin alias in a layout:</p>
<pre><code class="language-javascript">layout {
default_tab_template {
children
pane size=1 borderless=true {
plugin location="compact-bar"
}
}
}
</code></pre>
<h3 id="a-note-about-cwd"><a class="header" href="#a-note-about-cwd">A note about cwd</a></h3>
<p>When an alias defined a <code>cwd</code> for its plugin (such as the filepicker example above), Zellij will add the <code>caller_cwd</code> configuration parameter with the cwd of the focused pane in addition to the configured cwd above, instead of overriding the configured cwd of the plugin. This is so that plugins may provide a nicer user experience to their users and still have the desired cwd configuration of the alias.</p>

Expand Down
5 changes: 5 additions & 0 deletions static/documentation/plugin-lifecycle.html
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@ <h3 id="load"><a class="header" href="#load">load</a></h3>
<p>Will be called when the plugin is loaded, this is a good place to <a href="./plugin-api-commands.html#subscribe">subscribe</a> to events that are interesting for this plugin.</p>
<h3 id="update"><a class="header" href="#update">update</a></h3>
<p>Will be called with an <a href="./plugin-api-events.html"><code>Event</code></a> if the plugin is subscribed to said event. If the plugin returns <code>true</code> from this function, Zellij will know it should be rendered and call its <code>render</code> function.</p>
<p>Since events are used for asynchronous communication between Zellij and the plugin, they do not follow
a specific order. This means, that a plugin could receive certain events (like <code>ModeUpdate</code>) before the
<code>PermissionRequestResult</code> event is received. Therefore the plugin should ensure, that dependencies within
the plugin logic between certain events are handled correctly. An example for waiting for the <code>PermissionRequestResult</code>
can be found in <a href="https://blog.nerd.rocks/posts/common-snippets-for-zellij-development/">this great plug post</a></p>
<h3 id="render"><a class="header" href="#render">render</a></h3>
<p>Will be called either after an <code>update</code> that requested it, or when the plugin otherwise needs to be re-rendered (eg. on startup, or when the plugin is resized). The <code>rows</code> and <code>cols</code> values represent the "content size" of the plugin (this will not include its surrounding frame if the user has pane frames enabled).</p>
<p>This function is expeted to print to <code>STDOUT</code> whatever the plugin would like to render inside its pane. For more information, see <a href="plugin-ui-rendering.html">plugin ui rendering</a>.</p>
Expand Down
15 changes: 15 additions & 0 deletions static/documentation/print.html
Original file line number Diff line number Diff line change
Expand Up @@ -3280,6 +3280,11 @@ <h3 id="load"><a class="header" href="#load">load</a></h3>
<p>Will be called when the plugin is loaded, this is a good place to <a href="./plugin-api-commands.html#subscribe">subscribe</a> to events that are interesting for this plugin.</p>
<h3 id="update"><a class="header" href="#update">update</a></h3>
<p>Will be called with an <a href="./plugin-api-events.html"><code>Event</code></a> if the plugin is subscribed to said event. If the plugin returns <code>true</code> from this function, Zellij will know it should be rendered and call its <code>render</code> function.</p>
<p>Since events are used for asynchronous communication between Zellij and the plugin, they do not follow
a specific order. This means, that a plugin could receive certain events (like <code>ModeUpdate</code>) before the
<code>PermissionRequestResult</code> event is received. Therefore the plugin should ensure, that dependencies within
the plugin logic between certain events are handled correctly. An example for waiting for the <code>PermissionRequestResult</code>
can be found in <a href="https://blog.nerd.rocks/posts/common-snippets-for-zellij-development/">this great plug post</a></p>
<h3 id="render"><a class="header" href="#render">render</a></h3>
<p>Will be called either after an <code>update</code> that requested it, or when the plugin otherwise needs to be re-rendered (eg. on startup, or when the plugin is resized). The <code>rows</code> and <code>cols</code> values represent the "content size" of the plugin (this will not include its surrounding frame if the user has pane frames enabled).</p>
<p>This function is expeted to print to <code>STDOUT</code> whatever the plugin would like to render inside its pane. For more information, see <a href="plugin-ui-rendering.html">plugin ui rendering</a>.</p>
Expand Down Expand Up @@ -3407,6 +3412,16 @@ <h4 id="indentation"><a class="header" href="#indentation">Indentation</a></h4>
<p>With this plugins block, whenever the bare <code>tab-bar</code> is used to refer to a plugin (be it in a <a href="./layouts.html">layout</a>, from the <a href="./zellij-plugin.html">command line</a>, from a <a href="./keybindings.html">keybinding</a> or from <a href="./plugin-pipes.html">another plugin</a>), Zellij will translate it to the internal <code>zellij:tab-bar</code> url. Whenever the bare <code>filepicker</code> url is used to refer to a plugin, Zellij will translate it to the built-in <code>zellij:strider</code> url will be used with the <code>cwd "/"</code> configuration.</p>
<p>Aliases can be added to this block or changed to swap the default built-in plugins to other implementations. Removing the default aliases entirely might cause Zellij not to function as expected.</p>
<p>When swapping the default aliases for custom plugins, it's important that these plugins implement the basic contract Zellij (and indeed, other plugins) expect of them. The following sections describe the contract for each default alias.</p>
<p>Here's an example on how to use the plugin alias in a layout:</p>
<pre><code class="language-javascript">layout {
default_tab_template {
children
pane size=1 borderless=true {
plugin location="compact-bar"
}
}
}
</code></pre>
<h3 id="a-note-about-cwd"><a class="header" href="#a-note-about-cwd">A note about cwd</a></h3>
<p>When an alias defined a <code>cwd</code> for its plugin (such as the filepicker example above), Zellij will add the <code>caller_cwd</code> configuration parameter with the cwd of the focused pane in addition to the configured cwd above, instead of overriding the configured cwd of the plugin. This is so that plugins may provide a nicer user experience to their users and still have the desired cwd configuration of the alias.</p>
<div style="break-before: page; page-break-before: always;"></div><h1 id="the-tab-bar-alias"><a class="header" href="#the-tab-bar-alias">The tab-bar Alias</a></h1>
Expand Down
2 changes: 1 addition & 1 deletion static/documentation/searchindex.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion static/documentation/searchindex.json

Large diffs are not rendered by default.

0 comments on commit 0a993db

Please sign in to comment.