xplr/docs/en/src/layouts.md

89 lines
2.2 KiB
Markdown
Raw Normal View History

2022-04-09 09:15:39 +00:00
### Layouts
2022-04-09 09:15:39 +00:00
xplr layouts define the structure of the UI, i.e. how many panel we see,
placement and size of the panels, how they look etc.
2022-04-09 09:15:39 +00:00
This is configuration exposed via the `xplr.config.layouts` API.
2022-04-09 09:15:39 +00:00
`xplr.config.layouts.builtin` contain some built-in panels which can be
overridden, but you can't add or remove panels in it.
2022-04-09 09:15:39 +00:00
You can add new panels in `xplr.config.layouts.custom`.
##### Example: Defining Custom Layout
```lua
xplr.config.layouts.builtin.default = {
Horizontal = {
config = {
margin = 1,
horizontal_margin = 1,
vertical_margin = 1,
2022-04-09 09:15:39 +00:00
constraints = {
{ Percentage = 50 },
{ Percentage = 50 },
}
},
splits = {
"Table",
"HelpMenu",
}
}
}
```
Result:
```
╭ /home ─────────────╮╭ Help [default] ────╮
│ ╭─── path ││. show hidden │
│ ├▸[ð Desktop/] ││/ search │
│ ├ ð Documents/ ││: action │
│ ├ ð Downloads/ ││? global help │
│ ├ ð GitHub/ ││G go to bottom │
│ ├ ð Music/ ││V select/unselect│
│ ├ ð Pictures/ ││ctrl duplicate as │
│ ├ ð Public/ ││ctrl next visit │
╰────────────────────╯╰────────────────────╯
```
2022-04-09 09:15:39 +00:00
#### xplr.config.layouts.builtin.default
The default layout
Type: [Layout](https://xplr.dev/en/layout)
#### xplr.config.layouts.builtin.no_help
The layout without help menu
Type: [Layout](https://xplr.dev/en/layout)
#### xplr.config.layouts.builtin.no_selection
The layout without selection panel
Type: [Layout](https://xplr.dev/en/layout)
#### xplr.config.layouts.builtin.no_help_no_selection
The layout without help menu and selection panel
Type: [Layout](https://xplr.dev/en/layout)
#### xplr.config.layouts.custom
This is where you can define custom layouts
Type: mapping of the following key-value pairs:
- key: string
- value: [Layout](https://xplr.dev/en/layout)
Example:
```lua
xplr.config.layouts.custom.example = "Nothing" -- Show a blank screen
xplr.config.general.initial_layout = "example" -- Load the example layout
```