docs: add tooltips information

This commit is contained in:
Jan De Dobbeleer 2021-06-13 13:54:21 +02:00 committed by Jan De Dobbeleer
parent dcada48c9d
commit fdebf28caa
2 changed files with 90 additions and 0 deletions

89
docs/docs/beta.mdx Normal file
View file

@ -0,0 +1,89 @@
---
id: beta
title: Beta Features
sidebar_label: 🍼 Beta Features
---
import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
## Tooltips
Tooltips are segments that are rendered as a right aligned prompt while you're typing certain keywords.
They behave similar to the other segments when it comes to how and when they are shown so you can tweak
them to act and look like you want. The key difference is that they can be invoked using `tips` which are the
commands you are typing. Due to the possibility of the use of an alias, you can define for which keyword
the segment should be rendered.
Due to limitations (or not having found a way just yet) this feature only work for `zsh` and `powershell` at
the time of writing.
### Configuration
You need to extend or create a custom theme with your tooltips. For example:
```json
{
"blocks": [
...
],
"tooltips": [
{
"type": "git",
"tips": ["git", "g"],
"style": "diamond",
"foreground": "#193549",
"background": "#fffb38",
"leading_diamond": "",
"trailing_diamond": "",
"properties": {
"display_status": true,
"display_upstream_icon": true,
"status_colors_enabled": true,
"local_changes_color": "#ff9248",
"ahead_and_behind_color": "#f26d50",
"behind_color": "#f17c37",
"ahead_color": "#89d1dc"
}
}
]
}
```
This configuration will render a right aligned git segment when you type `git` or `g` followed by a space. Keep in mind that
this is a blocking call, meaning that if the segment renders slow, you can't type until it's visible. Optimizations in this space
are being explored.
### Enable the feature
<Tabs
defaultValue="pwsh"
groupId="shell"
values={[
{ label: 'powershell', value: 'pwsh', },
{ label: 'zsh', value: 'zsh', },
]
}>
<TabItem value="pwsh">
Import/invoke Oh My Posh in your `$PROFILE` and add the following setting:
```pwsh
$Global:PoshSettings.EnableToolTips = $true
```
Restart your shell or reload your `$PROFILE` using `. $PROFILE` for the changes to take effect.
</TabItem>
<TabItem value="zsh">
Invoke Oh My Posh in `.zshrc` and add the following setting:
```bash
enable_poshtooltips
```
Restart your shell or reload `.zshrc` using `source ~/.zshrc` for the changes to take effect.
</TabItem>
</Tabs>

View file

@ -17,6 +17,7 @@ module.exports = {
],
},
"configure",
"beta",
"themes",
"share",
"fonts",