mirror of
https://github.com/starship/starship.git
synced 2026-06-22 02:02:12 +07:00
New translations readme.md (Norwegian)
[ci skip]
This commit is contained in:
@@ -1,14 +1,22 @@
|
||||
# Advanced Configuration
|
||||
|
||||
While Starship is a versatile shell, sometimes you need to do more than edit `starship.toml` to get it to do certain things. This page details some of the more advanced configuration techniques used in starship.
|
||||
While Starship is a versatile shell, sometimes you need to do more than edit
|
||||
`starship.toml` to get it to do certain things. This page details some of the more
|
||||
advanced configuration techniques used in starship.
|
||||
|
||||
> [!WARNING] The configurations in this section are subject to change in future releases of Starship.
|
||||
|
||||
## TransientPrompt in PowerShell
|
||||
|
||||
It is possible to replace the previous-printed prompt with a custom string. This is useful in cases where all the prompt information is not always needed. To enable this, run `Enable-TransientPrompt` in the shell session. To make it permanent, put this statement in your `$PROFILE`. Transience can be disabled on-the-fly with `Disable-TransientPrompt`.
|
||||
It is possible to replace the previous-printed prompt with a custom string. This
|
||||
is useful in cases where all the prompt information is not always needed. To enable
|
||||
this, run `Enable-TransientPrompt` in the shell session. To make it permanent, put
|
||||
this statement in your `$PROFILE`. Transience can be disabled on-the-fly with
|
||||
`Disable-TransientPrompt`.
|
||||
|
||||
By default, the left side of input gets replaced with `>`. To customize this, define a new function called `Invoke-Starship-TransientFunction`. For example, to display Starship's `character` module here, you would do
|
||||
By default, the left side of input gets replaced with `>`. To customize this,
|
||||
define a new function called `Invoke-Starship-TransientFunction`. For example, to
|
||||
display Starship's `character` module here, you would do
|
||||
|
||||
```powershell
|
||||
function Invoke-Starship-TransientFunction {
|
||||
@@ -22,15 +30,21 @@ Enable-TransientPrompt
|
||||
|
||||
## TransientPrompt and TransientRightPrompt in Cmd
|
||||
|
||||
Clink allows you to replace the previous-printed prompt with custom strings. This is useful in cases where all the prompt information is not always needed. To enable this, run `clink set prompt.transient <value>` where \<value\> can be one of:
|
||||
Clink allows you to replace the previous-printed prompt with custom strings. This
|
||||
is useful in cases where all the prompt information is not always needed. To enable
|
||||
this, run `clink set prompt.transient <value>` where \<value\> can be one of:
|
||||
|
||||
- `always`: always replace the previous prompt
|
||||
- `same_dir`: replace the previous prompt only if the working directory is same
|
||||
- `off`: do not replace the prompt (i.e. turn off transience)
|
||||
|
||||
You need to do this only once. Make the following changes to your `starship.lua` to customize what gets displayed on the left and on the right:
|
||||
You need to do this only once. Make the following changes to your `starship.lua`
|
||||
to customize what gets displayed on the left and on the right:
|
||||
|
||||
- By default, the left side of input gets replaced with `>`. To customize this, define a new function called `starship_transient_prompt_func`. This function receives the current prompt as a string that you can utilize. For example, to display Starship's `character` module here, you would do
|
||||
- By default, the left side of input gets replaced with `>`. To customize this,
|
||||
define a new function called `starship_transient_prompt_func`. This function
|
||||
receives the current prompt as a string that you can utilize. For example, to
|
||||
display Starship's `character` module here, you would do
|
||||
|
||||
```lua
|
||||
function starship_transient_prompt_func(prompt)
|
||||
@@ -41,7 +55,10 @@ end
|
||||
load(io.popen('starship init cmd'):read("*a"))()
|
||||
```
|
||||
|
||||
- By default, the right side of input is empty. To customize this, define a new function called `starship_transient_rprompt_func`. This function receives the current prompt as a string that you can utilize. For example, to display the time at which the last command was started here, you would do
|
||||
- By default, the right side of input is empty. To customize this, define a new
|
||||
function called `starship_transient_rprompt_func`. This function receives the
|
||||
current prompt as a string that you can utilize. For example, to display
|
||||
the time at which the last command was started here, you would do
|
||||
|
||||
```lua
|
||||
function starship_transient_rprompt_func(prompt)
|
||||
@@ -52,11 +69,17 @@ load(io.popen('starship init cmd'):read("*a"))()
|
||||
|
||||
## TransientPrompt and TransientRightPrompt in Fish
|
||||
|
||||
It is possible to replace the previous-printed prompt with a custom string. This is useful in cases where all the prompt information is not always needed. To enable this, run `enable_transience` in the shell session. To make it permanent, put this statement in your `~/.config/fish/config.fish`. Transience can be disabled on-the-fly with `disable_transience`.
|
||||
It is possible to replace the previous-printed prompt with a custom string. This
|
||||
is useful in cases where all the prompt information is not always needed. To enable
|
||||
this, run `enable_transience` in the shell session. To make it permanent, put
|
||||
this statement in your `~/.config/fish/config.fish`. Transience can be disabled on-the-fly with
|
||||
`disable_transience`.
|
||||
|
||||
Note that in case of Fish, the transient prompt is only printed if the commandline is non-empty, and syntactically correct.
|
||||
|
||||
- By default, the left side of input gets replaced with a bold-green `❯`. To customize this, define a new function called `starship_transient_prompt_func`. For example, to display Starship's `character` module here, you would do
|
||||
- By default, the left side of input gets replaced with a bold-green `❯`. To customize this,
|
||||
define a new function called `starship_transient_prompt_func`. For example, to
|
||||
display Starship's `character` module here, you would do
|
||||
|
||||
```fish
|
||||
function starship_transient_prompt_func
|
||||
@@ -66,7 +89,9 @@ starship init fish | source
|
||||
enable_transience
|
||||
```
|
||||
|
||||
- By default, the right side of input is empty. To customize this, define a new function called `starship_transient_rprompt_func`. For example, to display the time at which the last command was started here, you would do
|
||||
- By default, the right side of input is empty. To customize this, define a new
|
||||
function called `starship_transient_rprompt_func`. For example, to display
|
||||
the time at which the last command was started here, you would do
|
||||
|
||||
```fish
|
||||
function starship_transient_rprompt_func
|
||||
@@ -78,19 +103,33 @@ enable_transience
|
||||
|
||||
## TransientPrompt and TransientRightPrompt in Bash
|
||||
|
||||
The [Ble.sh](https://github.com/akinomyoga/ble.sh) framework at v0.4 or higher allows you to replace the previous-printed prompt with custom strings. This is useful in cases where all the prompt information is not always needed. To enable this, put this in `~/.bashrc` `bleopt prompt_ps1_transient=<value>`:
|
||||
The [Ble.sh](https://github.com/akinomyoga/ble.sh) framework at v0.4 or higher allows you to replace
|
||||
the previous-printed prompt with custom strings. This is useful in cases where all
|
||||
the prompt information is not always needed. To enable this, put this in `~/.bashrc`
|
||||
`bleopt prompt_ps1_transient=<value>`:
|
||||
|
||||
The \<value\> here is a colon-separated list of `always`, `same-dir` and `trim`. When `prompt_ps1_final` is empty and the option `prompt_ps1_transient` has a non-empty \<value\>, the prompt specified by `PS1` is erased on leaving the current command line. If \<value\> contains a field `trim`, only the last line of multiline `PS1` is preserved and the other lines are erased. Otherwise, the command line will be redrawn as if `PS1=` is specified. When a field `same-dir` is contained in \<value\> and the current working directory is different from the final directory of the previous command line, this option `prompt_ps1_transient` is ignored.
|
||||
The \<value\> here is a colon-separated list of `always`, `same-dir` and `trim`.
|
||||
When `prompt_ps1_final` is empty and the option `prompt_ps1_transient` has a non-empty \<value\>,
|
||||
the prompt specified by `PS1` is erased on leaving the current command line.
|
||||
If \<value\> contains a field `trim`, only the last line of multiline `PS1` is
|
||||
preserved and the other lines are erased. Otherwise, the command line will be
|
||||
redrawn as if `PS1=` is specified. When a field `same-dir` is contained in
|
||||
\<value\> and the current working directory is different from the final directory of
|
||||
the previous command line, this option `prompt_ps1_transient` is ignored.
|
||||
|
||||
Make the following changes to your `~/.blerc` (or in `~/.config/blesh/init.sh`) to customize what gets displayed on the left and on the right:
|
||||
|
||||
- To customize what the left side of input gets replaced with, configure the `prompt_ps1_final` Ble.sh option. For example, to display Starship's `character` module here, you would do
|
||||
- To customize what the left side of input gets replaced with, configure the
|
||||
`prompt_ps1_final` Ble.sh option. For example, to display Starship's `character`
|
||||
module here, you would do
|
||||
|
||||
```bash
|
||||
bleopt prompt_ps1_final='$(starship module character)'
|
||||
```
|
||||
|
||||
- To customize what the right side of input gets replaced with, configure the `prompt_rps1_final` Ble.sh option. For example, to display the time at which the last command was started here, you would do
|
||||
- To customize what the right side of input gets replaced with, configure the
|
||||
`prompt_rps1_final` Ble.sh option. For example, to display
|
||||
the time at which the last command was started here, you would do
|
||||
|
||||
```bash
|
||||
bleopt prompt_rps1_final='$(starship module time)'
|
||||
@@ -98,9 +137,14 @@ bleopt prompt_rps1_final='$(starship module time)'
|
||||
|
||||
## Custom pre-prompt and pre-execution Commands in Cmd
|
||||
|
||||
Clink provides extremely flexible APIs to run pre-prompt and pre-exec commands in Cmd shell. It is fairly simple to use with Starship. Make the following changes to your `starship.lua` file as per your requirements:
|
||||
Clink provides extremely flexible APIs to run pre-prompt and pre-exec commands
|
||||
in Cmd shell. It is fairly simple to use with Starship. Make the following changes
|
||||
to your `starship.lua` file as per your requirements:
|
||||
|
||||
- To run a custom function right before the prompt is drawn, define a new function called `starship_preprompt_user_func`. This function receives the current prompt as a string that you can utilize. For example, to draw a rocket before the prompt, you would do
|
||||
- To run a custom function right before the prompt is drawn, define a new
|
||||
function called `starship_preprompt_user_func`. This function receives
|
||||
the current prompt as a string that you can utilize. For example, to
|
||||
draw a rocket before the prompt, you would do
|
||||
|
||||
```lua
|
||||
function starship_preprompt_user_func(prompt)
|
||||
@@ -110,7 +154,10 @@ end
|
||||
load(io.popen('starship init cmd'):read("*a"))()
|
||||
```
|
||||
|
||||
- To run a custom function right before a command is executed, define a new function called `starship_precmd_user_func`. This function receives the current commandline as a string that you can utilize. For example, to print the command that's about to be executed, you would do
|
||||
- To run a custom function right before a command is executed, define a new
|
||||
function called `starship_precmd_user_func`. This function receives
|
||||
the current commandline as a string that you can utilize. For example, to
|
||||
print the command that's about to be executed, you would do
|
||||
|
||||
```lua
|
||||
function starship_precmd_user_func(line)
|
||||
@@ -122,9 +169,14 @@ load(io.popen('starship init cmd'):read("*a"))()
|
||||
|
||||
## Custom pre-prompt and pre-execution Commands in Bash
|
||||
|
||||
Bash does not have a formal preexec/precmd framework like most other shells. Because of this, it is difficult to provide fully customizable hooks in `bash`. However, Starship does give you limited ability to insert your own functions into the prompt-rendering procedure:
|
||||
Bash does not have a formal preexec/precmd framework like most other shells.
|
||||
Because of this, it is difficult to provide fully customizable hooks in `bash`.
|
||||
However, Starship does give you limited ability to insert your own functions
|
||||
into the prompt-rendering procedure:
|
||||
|
||||
- To run a custom function right before the prompt is drawn, define a new function and then assign its name to `starship_precmd_user_func`. For example, to draw a rocket before the prompt, you would do
|
||||
- To run a custom function right before the prompt is drawn, define a new
|
||||
function and then assign its name to `starship_precmd_user_func`. For example,
|
||||
to draw a rocket before the prompt, you would do
|
||||
|
||||
```bash
|
||||
function blastoff(){
|
||||
@@ -133,7 +185,11 @@ function blastoff(){
|
||||
starship_precmd_user_func="blastoff"
|
||||
```
|
||||
|
||||
- To run a custom function right before a command runs, you can use the [`DEBUG` trap mechanism](https://jichu4n.com/posts/debug-trap-and-prompt_command-in-bash/). However, you **must** trap the DEBUG signal _before_ initializing Starship! Starship can preserve the value of the DEBUG trap, but if the trap is overwritten after starship starts up, some functionality will break.
|
||||
- To run a custom function right before a command runs, you can use the
|
||||
[`DEBUG` trap mechanism](https://jichu4n.com/posts/debug-trap-and-prompt_command-in-bash/).
|
||||
However, you **must** trap the DEBUG signal _before_ initializing Starship!
|
||||
Starship can preserve the value of the DEBUG trap, but if the trap is overwritten
|
||||
after starship starts up, some functionality will break.
|
||||
|
||||
```bash
|
||||
function blastoff(){
|
||||
@@ -147,7 +203,10 @@ set +o functrace
|
||||
|
||||
## Custom pre-prompt and pre-execution Commands in PowerShell
|
||||
|
||||
PowerShell does not have a formal preexec/precmd framework like most other shells. Because of this, it is difficult to provide fully customizable hooks in `powershell`. However, Starship does give you limited ability to insert your own functions into the prompt-rendering procedure:
|
||||
PowerShell does not have a formal preexec/precmd framework like most other shells.
|
||||
Because of this, it is difficult to provide fully customizable hooks in `powershell`.
|
||||
However, Starship does give you limited ability to insert your own functions
|
||||
into the prompt-rendering procedure:
|
||||
|
||||
Create a function named `Invoke-Starship-PreCommand`
|
||||
|
||||
@@ -159,7 +218,10 @@ function Invoke-Starship-PreCommand {
|
||||
|
||||
## Change Window Title
|
||||
|
||||
Some shell prompts will automatically change the window title for you (e.g. to reflect your working directory). Fish even does it by default. Starship does not do this, but it's fairly straightforward to add this functionality to `bash`, `zsh`, `cmd` or `powershell`.
|
||||
Some shell prompts will automatically change the window title for you (e.g. to
|
||||
reflect your working directory). Fish even does it by default.
|
||||
Starship does not do this, but it's fairly straightforward to add this
|
||||
functionality to `bash`, `zsh`, `cmd` or `powershell`.
|
||||
|
||||
First, define a window title change function (identical in bash and zsh):
|
||||
|
||||
@@ -217,9 +279,13 @@ Invoke-Expression (&starship init powershell)
|
||||
|
||||
## Enable Right Prompt
|
||||
|
||||
Some shells support a right prompt which renders on the same line as the input. Starship can set the content of the right prompt using the `right_format` option. Any module that can be used in `format` is also supported in `right_format`. The `$all` variable will only contain modules not explicitly used in either `format` or `right_format`.
|
||||
Some shells support a right prompt which renders on the same line as the input. Starship can
|
||||
set the content of the right prompt using the `right_format` option. Any module that can be used
|
||||
in `format` is also supported in `right_format`. The `$all` variable will only contain modules
|
||||
not explicitly used in either `format` or `right_format`.
|
||||
|
||||
Note: The right prompt is a single line following the input location. To right align modules above the input line in a multi-line prompt, see the [`fill` module](../config/#fill).
|
||||
Note: The right prompt is a single line following the input location. To right align modules above
|
||||
the input line in a multi-line prompt, see the [`fill` module](../config/#fill).
|
||||
|
||||
`right_format` is currently supported for the following shells: elvish, fish, zsh, xonsh, cmd, nushell, bash.
|
||||
|
||||
@@ -243,6 +309,12 @@ Produces a prompt like the following:
|
||||
▶ starship on rprompt [!] is 📦 v0.57.0 via 🦀 v1.54.0 took 17s
|
||||
```
|
||||
|
||||
When using `zsh` (v5.0.5+), the shell adds a default trailing space to the right prompt. This can cause alignment issues specifically when using the Starship `$fill` module. To remove this gap, add the following to your `.zshrc`:
|
||||
|
||||
```zsh
|
||||
ZLE_RPROMPT_INDENT=0
|
||||
```
|
||||
|
||||
## Continuation Prompt
|
||||
|
||||
Some shells support a continuation prompt along with the normal prompt. This prompt is rendered instead of the normal prompt when the user has entered an incomplete statement (such as a single left parenthesis or quote).
|
||||
@@ -338,22 +410,22 @@ The `claude_model` module displays the current Claude model being used in the se
|
||||
|
||||
#### Options
|
||||
|
||||
| Option | Default | Description |
|
||||
| --------------- | ---------------------------- | ----------------------------------------------------------------------------------------- |
|
||||
| `format` | `'[$symbol$model]($style) '` | The format for the module. |
|
||||
| `symbol` | `'🤖 '` | The symbol shown before the model name. |
|
||||
| `style` | `'bold blue'` | The style for the module. |
|
||||
| Option | Default | Description |
|
||||
| --------------- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `format` | `'[$symbol$model]($style) '` | The format for the module. |
|
||||
| `symbol` | `'🤖 '` | The symbol shown before the model name. |
|
||||
| `style` | `'bold blue'` | The style for the module. |
|
||||
| `model_aliases` | `{}` | Map of model IDs or display names to shorter aliases. Checks ID first, then display name. |
|
||||
| `disabled` | `false` | Disables the `claude_model` module. |
|
||||
| `disabled` | `false` | Disables the `claude_model` module. |
|
||||
|
||||
#### Variables
|
||||
|
||||
| Variable | Example | Description |
|
||||
| --------- | ------------------- | ------------------------------------- |
|
||||
| model | `Claude 3.5 Sonnet` | The display name of the current model |
|
||||
| model_id | `claude-3-5-sonnet` | The model ID |
|
||||
| symbol | | Mirrors the value of option `symbol` |
|
||||
| style\* | | Mirrors the value of option `style` |
|
||||
| Variable | Example | Description |
|
||||
| ----------------------------- | ------------------- | ------------------------------------- |
|
||||
| model | `Claude 3.5 Sonnet` | The display name of the current model |
|
||||
| model_id | `claude-3-5-sonnet` | The model ID |
|
||||
| symbol | | Mirrors the value of option `symbol` |
|
||||
| style\* | | Mirrors the value of option `style` |
|
||||
|
||||
\*: This variable can only be used as a part of a style string
|
||||
|
||||
@@ -383,8 +455,8 @@ The `claude_context` module displays context window usage as a percentage and vi
|
||||
|
||||
#### Options
|
||||
|
||||
| Option | Default | Description |
|
||||
| ---------------------- | --------------------------------- | -------------------------------------------------- |
|
||||
| Option | Default | Description |
|
||||
| ---------------------- | --------------------------------- | ------------------------------------------------------------------ |
|
||||
| `format` | `'[$gauge $percentage]($style) '` | The format for the module. |
|
||||
| `symbol` | `''` | The symbol shown before the gauge. |
|
||||
| `gauge_width` | `5` | The width of the gauge in characters. |
|
||||
@@ -402,7 +474,7 @@ The `display` option is an array of objects that define thresholds and styles fo
|
||||
| ----------- | ------------ | ------------------------------------------------------------------------ |
|
||||
| `threshold` | `0.0` | The minimum context windows usage percentage to match this configuration |
|
||||
| `style` | `bold green` | The value of `style` if this display configuration is matched |
|
||||
| `hidden` | `false` | Hide this module if this the configuration is matched. |
|
||||
| `hidden` | `false` | Hide this module if this the configuration is matched. |
|
||||
|
||||
```toml
|
||||
[[claude_context.display]]
|
||||
@@ -424,19 +496,19 @@ style = "bold red"
|
||||
|
||||
#### Variables
|
||||
|
||||
| Variable | Example | Description |
|
||||
| ---------------------------- | ------- | ----------------------------------------------------- |
|
||||
| gauge | `██▒░░` | Visual representation of context usage |
|
||||
| percentage | `65%` | Context usage as a percentage |
|
||||
| input_tokens | `45.2k` | Total input tokens in conversation |
|
||||
| output_tokens | `12.3k` | Total output tokens in conversation |
|
||||
| curr_input_tokens | `5.1k` | Input tokens from most recent API call |
|
||||
| curr_output_tokens | `1.2k` | Output tokens from most recent API call |
|
||||
| Variable | Example | Description |
|
||||
| ----------------------------------------------------------------------------------------- | ------- | ----------------------------------------------------- |
|
||||
| gauge | `██▒░░` | Visual representation of context usage |
|
||||
| percentage | `65%` | Context usage as a percentage |
|
||||
| input_tokens | `45.2k` | Total input tokens in conversation |
|
||||
| output_tokens | `12.3k` | Total output tokens in conversation |
|
||||
| curr_input_tokens | `5.1k` | Input tokens from most recent API call |
|
||||
| curr_output_tokens | `1.2k` | Output tokens from most recent API call |
|
||||
| curr_cache_creation_tokens | `1.5k` | Cache creation tokens from most recent API call |
|
||||
| curr_cache_read_tokens | `23.4k` | Cache read tokens from most recent API call |
|
||||
| total_tokens | `200k` | Total context window size |
|
||||
| symbol | | Mirrors the value of option `symbol` |
|
||||
| style\* | | Mirrors the style from the matching display threshold |
|
||||
| total_tokens | `200k` | Total context window size |
|
||||
| symbol | | Mirrors the value of option `symbol` |
|
||||
| style\* | | Mirrors the style from the matching display threshold |
|
||||
|
||||
\*: This variable can only be used as a part of a style string
|
||||
|
||||
@@ -502,10 +574,10 @@ The `claude_cost` module displays the total cost of the current Claude Code sess
|
||||
|
||||
#### Options
|
||||
|
||||
| Option | Default | Description |
|
||||
| ---------- | ---------------------------------- | ----------------------------------- |
|
||||
| Option | Default | Description |
|
||||
| ---------- | ---------------------------------- | --------------------------------------------------- |
|
||||
| `format` | `'[$symbol(\\$$cost)]($style) '` | The format for the module. |
|
||||
| `symbol` | `'💰 '` | The symbol shown before the cost. |
|
||||
| `symbol` | `'💰 '` | The symbol shown before the cost. |
|
||||
| `display` | [see below](#display-1) | Threshold and style configurations. |
|
||||
| `disabled` | `false` | Disables the `claude_cost` module. |
|
||||
|
||||
@@ -513,11 +585,11 @@ The `claude_cost` module displays the total cost of the current Claude Code sess
|
||||
|
||||
The `display` option is an array of objects that define cost thresholds and styles. The module uses the style from the highest matching threshold or hides the module if `hidden` is `true`.
|
||||
|
||||
| Option | Default | Description |
|
||||
| ----------- | ------------ | ------------------------------------------------------------- |
|
||||
| `threshold` | `0.0` | The minimum cost in USD to match this configuration |
|
||||
| `style` | `bold green` | The value of `style` if this display configuration is matched |
|
||||
| `hidden` | `false` | Hide this module if this configuration is matched. |
|
||||
| Option | Default | Description |
|
||||
| ----------- | ------------ | ------------------------------------------------------------------ |
|
||||
| `threshold` | `0.0` | The minimum cost in USD to match this configuration |
|
||||
| `style` | `bold green` | The value of `style` if this display configuration is matched |
|
||||
| `hidden` | `false` | Hide this module if this configuration is matched. |
|
||||
|
||||
**Default configuration:**
|
||||
|
||||
@@ -537,15 +609,15 @@ style = "bold red"
|
||||
|
||||
#### Variables
|
||||
|
||||
| Variable | Example | Description |
|
||||
| ------------- | -------- | ----------------------------------------------------- |
|
||||
| cost | `1.23` | Total session cost in USD (formatted to 2 decimals) |
|
||||
| duration | `1m 30s` | Total session duration |
|
||||
| api_duration | `45s` | Total API call duration |
|
||||
| lines_added | `1.2k` | Total lines of code added |
|
||||
| lines_removed | `500` | Total lines of code removed |
|
||||
| symbol | | Mirrors the value of option `symbol` |
|
||||
| style\* | | Mirrors the style from the matching display threshold |
|
||||
| Variable | Example | Description |
|
||||
| ---------------------------------- | -------- | ---------------------------------------------------------------------- |
|
||||
| cost | `1.23` | Total session cost in USD (formatted to 2 decimals) |
|
||||
| duration | `1m 30s` | Total session duration |
|
||||
| api_duration | `45s` | Total API call duration |
|
||||
| lines_added | `1.2k` | Total lines of code added |
|
||||
| lines_removed | `500` | Total lines of code removed |
|
||||
| symbol | | Mirrors the value of option `symbol` |
|
||||
| style\* | | Mirrors the style from the matching display threshold |
|
||||
|
||||
\*: This variable can only be used as a part of a style string
|
||||
|
||||
@@ -593,14 +665,19 @@ Style strings are a list of words, separated by whitespace. The words are not ca
|
||||
- `<color>`
|
||||
- `none`
|
||||
|
||||
where `<color>` is a color specifier (discussed below). `fg:<color>` and `<color>` currently do the same thing, though this may change in the future. `<color>` can also be set to `prev_fg` or `prev_bg` which evaluates to the previous item's foreground or background color respectively if available or `none` otherwise. `inverted` swaps the background and foreground colors. The order of words in the string does not matter.
|
||||
where `<color>` is a color specifier (discussed below). `fg:<color>` and `<color>` currently do the same thing, though this may change in the future.
|
||||
`<color>` can also be set to `prev_fg` or `prev_bg` which evaluates to the previous item's foreground or background color respectively if available or `none` otherwise.
|
||||
`inverted` swaps the background and foreground colors. The order of words in the string does not matter.
|
||||
|
||||
The `none` token overrides all other tokens in a string if it is not part of a `bg:` specifier, so that e.g. `fg:red none fg:blue` will still create a string with no styling. `bg:none` sets the background to the default color so `fg:red bg:none` is equivalent to `red` or `fg:red` and `bg:green fg:red bg:none` is also equivalent to `fg:red` or `red`. It may become an error to use `none` in conjunction with other tokens in the future.
|
||||
|
||||
A color specifier can be one of the following:
|
||||
|
||||
- One of the standard terminal colors: `black`, `red`, `green`, `blue`, `yellow`, `purple`, `cyan`, `white`. You can optionally prefix these with `bright-` to get the bright version (e.g. `bright-white`).
|
||||
- A `#` followed by a six-digit hexadecimal number. This specifies an [RGB color hex code](https://www.w3schools.com/colors/colors_hexadecimal.asp).
|
||||
- One of the standard terminal colors: `black`, `red`, `green`, `blue`,
|
||||
`yellow`, `purple`, `cyan`, `white`. You can optionally prefix these
|
||||
with `bright-` to get the bright version (e.g. `bright-white`).
|
||||
- A `#` followed by a six-digit hexadecimal number. This specifies an
|
||||
[RGB color hex code](https://www.w3schools.com/colors/colors_hexadecimal.asp).
|
||||
- A number between 0-255. This specifies an [8-bit ANSI Color Code](https://i.stack.imgur.com/KTSQa.png).
|
||||
|
||||
If multiple colors are specified for foreground/background, the last one in the string will take priority.
|
||||
|
||||
Reference in New Issue
Block a user