Add plugin docs

Also minor doc improvements
This commit is contained in:
Arijit Basu 2021-06-24 09:03:28 +05:30 committed by Arijit Basu
parent 7ed89a4aff
commit 3cadaf8880
9 changed files with 160 additions and 47 deletions

View File

@ -54,54 +54,24 @@ Table of content
- [Node Types](https://arijitbasu.in/xplr/en/node_types.html)
- [Style](https://arijitbasu.in/xplr/en/style.html)
- [Default Key Bindings](https://arijitbasu.in/xplr/en/default-key-bindings.html)
- [Plugin](https://arijitbasu.in/xplr/en/default-key-bindings.html)
- [Installing Plugins](https://arijitbasu.in/xplr/en/installing-plugins.html)
- [Writing Plugins](https://arijitbasu.in/xplr/en/writing-plugins.html)
- [Awesome Plugins](https://arijitbasu.in/xplr/en/awesome-plugins.html)
- [TODO](https://arijitbasu.in/xplr/en/todo.html)
- [Hacks](https://github.com/sayanarijit/xplr/wiki/Hacks)
- [Themes](https://github.com/sayanarijit/xplr/wiki/Themes)
- [Alternatives](https://github.com/sayanarijit/xplr/wiki/alternatives.html)
- [Upgrade Guide](https://github.com/sayanarijit/xplr/wiki/upgrade-guide.html)
- [Community](https://github.com/sayanarijit/xplr/wiki/community.html)
- [Contribute](https://github.com/sayanarijit/xplr/wiki/contribute.html)
- [Alternatives](https://arijitbasu.in/xplr/en/alternatives.html)
- [Upgrade Guide](https://arijitbasu.in/xplr/en/upgrade-guide.html)
- [Community](https://arijitbasu.in/xplr/en/community.html)
- [Contribute](https://arijitbasu.in/xplr/en/contribute.html)
## Demo
<details>
<summary>Expand for demo</summary>
<p align="center">
<a href="https://github.com/sayanarijit/xplr/wiki/Hacks#fuzzy-search-with-preview" target="_blank">
<img height=240 width=360 src="https://s4.gifyu.com/images/xplr-fzf.gif" />
</a>
<a href="https://github.com/sayanarijit/xplr/wiki/Hacks#batch-rename" target="_blank">
<img height=240 width=360 src="https://s4.gifyu.com/images/xplr-rename.gif" />
</a>
<a href="https://github.com/sayanarijit/xplr/wiki/Hacks#serve-pwd" target="_blank">
<img height=240 width=360 src="https://s3.gifyu.com/images/xplr-serve.gif" />
</a>
<a href="https://github.com/sayanarijit/xplr/wiki/Themes#material-landscape" target="_blank">
<img height=240 width=360 src="https://s3.gifyu.com/images/theaming.gif" />
</a>
<a href="https://github.com/sayanarijit/xplr/wiki/Hacks#sendreceive-files-via-qr-code-on-lan" target="_blank">
<img height=240 width=360 src="https://s4.gifyu.com/images/xplr-qr.gif" />
</a>
<a href="https://github.com/sayanarijit/xplr/wiki/Hacks#spawn-multiple-sessions-in-different-windows" target="_blank">
<img height=240 width=360 src="https://s3.gifyu.com/images/xplr-sessions.gif" />
</a>
</p>
</details>
## Packaging
Packaging
---------
<a href="https://repology.org/project/xplr/versions" target="_blank"><img src="https://repology.org/badge/vertical-allrepos/xplr.svg" /></a>
## Backers
Backers
-------
<a href="https://opencollective.com/xplr#backer" target="_blank"><img src="https://opencollective.com/xplr/tiers/backer.svg?width=890" /></a>

View File

@ -13,6 +13,10 @@ A hackable, minimal, fast TUI file explorer
- [Node Types](node_types.md)
- [Style](style.md)
- [Default Key Bindings](default-key-bindings.md)
- [Plugin](plugin.md)
- [Installing Plugins](installing-plugins.md)
- [Writing Plugins](writing-plugins.md)
- [Awesome Plugins](awesome-plugins.md)
- [TODO](todo.md)
- [Alternatives](alternatives.md)
- [Upgrade Guide](upgrade-guide.md)

View File

@ -0,0 +1,21 @@
Awesome Plugins
===============
Categories
----------
- [Theme](#theme)
- [Integration](#integration)
Theme
-----
- [material-landscape.xplr](https://github.com/sayanarijit/material-landscape.xplr)
- [material-landscape2.xplr](https://github.com/sayanarijit/material-landscape2.xplr)
Integration
-----------
foo

View File

@ -16,7 +16,7 @@ that case, both `~/.config/xplr/init.lua` and `/etc/xplr/init.lua` will be
ignored.
How Config is Loaded
How Config Is Loaded
--------------------
When xplr loads, it first executes the built-in
@ -25,3 +25,14 @@ the default values, which is then overwritten by another config file, if found
using the following lookup order:
**--config /path/to/init.lua** > **~/.config/xplr/init.lua** > **/etc/xplr/init.lua**
How to Configure
----------------
- [General Config](general-config.md)
- [Modes](modes.md)
- [Message](message.md)
- [Layouts](layouts.md)
- [Node Types](node_types.md)
- [Style](style.md)

View File

@ -0,0 +1,28 @@
Installing Plugins
==================
Until we get a cool plugin manager, let's install plugins manually using the
following procedure:
- Add the following line in `~/.config/xplr/init.lua`
```lua
package.path = os.getenv("HOME") .. '/.config/xplr/plugins/?/src/init.lua'
```
- Clone the plugin
```bash
mkdir -p ~/.config/xplr/plugins
git clone https://github.com/sayanarijit/material-landscape2.xplr ~/.config/xplr/plugins/material-landscape2
```
- Require the module in `~/.config/xplr/init.lua`
```lua
require("material-landscape2").setup()
-- The setup arguments might differ for different plugins.
-- Visit the project README for setup instructions.
```

View File

@ -2,7 +2,7 @@ Modes
=====
xplr is a modal file explorer. That means the users switch between different
modes, each containing a different set to key bindings to avoid clashes. Users
modes, each containing a different set of key bindings to avoid clashes. Users
can switch between these modes at run-time.
The modes can be configured using the `xplr.config.modes` Lua API.
@ -258,3 +258,7 @@ xplr.config.modes.builtin.default.key_bindings.on_key["F"] = {
Now let's try out the new `xplr`-`fzf` integration.
[![xplr-fzf.gif](https://s3.gifyu.com/images/xplr-fzf.gif)](https://gifyu.com/image/tW86)
-----
Visit [Awesome Plugins](awesome-plugins.md) for more [integration](awesome-plugins.md#integration) options.

9
docs/en/src/plugin.md Normal file
View File

@ -0,0 +1,9 @@
Plugin
======
xplr supports pluggable Lua modules that can be used to easily configure or
extend xplr UI and functionalities.
- [Installing Plugins](installing-plugins.md)
- [Writing Plugins](writing-plugins.md)
- [Awesome Plugins](awesome-plugins.md)

View File

@ -1,5 +1,8 @@
Quickstart
==========
In this chapter, we'll learn how to install and configure xplr on our machine
for the first time.
Nice yo have to have here! Let's start quickly start our xplr journey with the
following steps:
- [Install](install.md)
- [Post Install](post-install.md)

View File

@ -0,0 +1,63 @@
Writing Plugins
===============
Anyone who can write [Lua](https://www.lua.org) code, can write xplr plugins.
Just follow the instructions and best practices:
Naming
------
xplr plugins are named using hiphen (`-`) separated words that may also include
integers. They will be plugged using the `require()` function in Lua.
Structure
---------
A minimal plugin should confirm to the following structure:
```
material-landscape
├── README.md
└── src
└── init.lua
```
You can also use
[this template](https://github.com/sayanarijit/plugin-template1.xplr).
### README.md
This is where you document what the plugin does, how to use it, etc.
### src/init.lua
This file is executed to load the plugin. It should expose a `setup()`
function, which will be used by the users to setup the plugin.
Example:
```lua
local function setup(args)
local xplr = xplr
-- do stuff with xplr
end
return { setup = setup }
```
Publishing
----------
When publishing plugins to GitHub or other repositories, it's a best practice
to append `.xplr` to the name to make them distinguishable. Similar to the
`*.nvim` naming convention for [Neovim](https://neovim.io) plugins.
Examples
--------
Visit [Awesome Plugins](awesome-plugins.md) for xplr plugin examples.