diff options
author | Matthew (Matt) Jeffryes <github@mjeffryes.net> | 2021-09-08 12:45:27 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-08 15:45:27 -0400 |
commit | 79585dcb17f904125e2881fa0182660fcd9002a8 (patch) | |
tree | 29fd5824073dbc2783f1005dd1d487b465d115d7 /docs | |
parent | cb8dca210151b9f53f8936ee3ca1c1838cf66ca6 (diff) |
feat: Add support for RPROMPT (right prompt) (#3026)
Adds support for zsh, fish, and elvish.
Co-authored-by: Matan Kushner <hello@matchai.dev>
Diffstat (limited to 'docs')
-rw-r--r-- | docs/advanced-config/README.md | 31 | ||||
-rw-r--r-- | docs/config/README.md | 22 |
2 files changed, 47 insertions, 6 deletions
diff --git a/docs/advanced-config/README.md b/docs/advanced-config/README.md index 0efecc21f..412b74de2 100644 --- a/docs/advanced-config/README.md +++ b/docs/advanced-config/README.md @@ -85,6 +85,37 @@ function set_win_title(){ starship_precmd_user_func="set_win_title" ``` +## 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`. + +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. + +### Example + +```toml +# ~/.config/starship.toml + +# A minimal left prompt +format = """$character""" + +# move the rest of the prompt to the right +right_format = """$all""" +``` + +Produces a prompt like the following: + +``` +▶ starship on rprompt [!] is 📦 v0.57.0 via 🦀 v1.54.0 took 17s +``` + + ## Style Strings Style strings are a list of words, separated by whitespace. The words are not case sensitive (i.e. `bold` and `BoLd` are considered the same string). Each word can be one of the following: diff --git a/docs/config/README.md b/docs/config/README.md index 8b7a61063..c7e942668 100644 --- a/docs/config/README.md +++ b/docs/config/README.md @@ -151,12 +151,14 @@ This is the list of prompt-wide configuration options. ### Options -| Option | Default | Description | -| ----------------- | ------------------------------ | ------------------------------------------------------------ | -| `format` | [link](#default-prompt-format) | Configure the format of the prompt. | -| `scan_timeout` | `30` | Timeout for starship to scan files (in milliseconds). | -| `command_timeout` | `500` | Timeout for commands executed by starship (in milliseconds). | -| `add_newline` | `true` | Inserts blank line between shell prompts. | +| Option | Default | Description | +| ----------------- | ------------------------------- | ---------------------------------------------------------------- | +| `format` | [link](#default-prompt-format) | Configure the format of the prompt. | +| `right_format` | `""` | See [Enable Right Prompt](/advanced-config/#enable-right-prompt) | +| `scan_timeout` | `30` | Timeout for starship to scan files (in milliseconds). | +| `command_timeout` | `500` | Timeout for commands executed by starship (in milliseconds). | +| `add_newline` | `true` | Inserts blank line between shell prompts. | + ### Example @@ -247,6 +249,14 @@ $shell\ $character""" ``` +If you just want to extend the default format, you can use `$all`; +modules you explicitly add to the format will not be duplicated. Eg. + +```toml +# Move the directory to the second line +format="$all$directory$character" +``` + ## AWS The `aws` module shows the current AWS region and profile. This is based on |