oh-my-posh/website/docs/configuration/block.mdx
Jan De Dobbeleer 3057e474d7 docs: tables for data
this look a lot better
2022-09-16 16:35:44 +02:00

123 lines
2.4 KiB
Plaintext

---
id: block
title: Block
sidebar_label: Block
---
import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
Let's take a closer look at what defines a block.
<Tabs
defaultValue="json"
groupId="sample"
values={[
{ label: 'json', value: 'json', },
{ label: 'yaml', value: 'yaml', },
{ label: 'toml', value: 'toml', },
]
}>
<TabItem value="json">
```json
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
...
"blocks": [
{
"type": "prompt",
"alignment": "left",
"segments": [
...
]
}
]
}
```
</TabItem>
<TabItem value="yaml">
```yaml
# yaml-language-server: $schema=https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json
---
blocks:
- type: prompt
alignment: left
segments: [...]
```
</TabItem>
<TabItem value="toml">
```toml
"$schema" = "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json"
[[blocks]]
type = "prompt"
alignment = "left"
segments = [
...
]
```
</TabItem>
</Tabs>
## Properties
| Name | Type |
| ----------- | --------- |
| `type` | `string` |
| `newline` | `boolean` |
| `alignment` | `string` |
| `filler` | `string` |
| `overflow` | `string` |
| `segments` | `array` |
### Type
Tells the engine what to do with the block. There are two options:
- `prompt` renders one or more segments
- `rprompt` renders one or more segments aligned to the right of the cursor. Only one `rprompt` block is permitted.
Supported on zsh, bash, PowerShell, cmd and fish.
### Newline
Start the block on a new line - defaults to `false`.
### Alignment
- `left`
- `right`
Tell the engine if the block should be left or right-aligned.
### Filler
When you want to join a right and left aligned block with a repeated set of characters, add the character(s)
to be repeated to this property. Add this property to the _right_ aligned block. This supports the use of
[color overrides][color-overrides].
```json
"alignment": "right",
"filler": "."
```
### Overflow
- `break`
- `hide`
When the right aligned block is so long it will overflow the left aligned block, the engine will either
break the block or hide it based on the setting. By default it is printed as is on the same line.
### Segments
Array of one or more [segments][segment].
[color-overrides]: /docs/configuration/colors#color-overrides
[segment]: segment.mdx