Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed public/assets/terminal/warp-custom-prompt-demo.mp4
Binary file not shown.
Binary file not shown.
Binary file removed src/assets/terminal/edit-prompt-modal.png
Binary file not shown.
117 changes: 38 additions & 79 deletions src/content/docs/terminal/appearance/prompt.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,35 @@ description: >-
sidebar:
label: "Prompt"
---
import DemoVideo from '@components/DemoVideo.astro';
import VideoEmbed from '@components/VideoEmbed.astro';

Warp supports two prompt types: the **Warp prompt** and the **Shell prompt (PS1)**.
Warp supports two prompt types: the **Warp prompt** and the **Shell prompt (PS1)**.

## Choosing your prompt type

To switch your prompt type:

1. Open **Settings** > **Appearance**.
1. In the Warp app, open **Settings** > **Appearance**.
2. Under **Input**, set **Input type** to **Warp** or **Shell (PS1)**.

When using the Warp prompt, you can right-click the prompt area to copy the entire prompt, working directory, current git branch, git uncommitted file count, and more.
With the Warp prompt, open the prompt context menu to copy the entire prompt or individual context chip values, such as the working directory or Git branch. Right-click the prompt, or use `Shift`+right-click if your right-click behavior is set to paste.

When using a Shell prompt, you can right-click the prompt area to copy the entire prompt, or select any part of the prompt in previously run blocks in your session.
With a Shell prompt, open the prompt context menu to copy the entire prompt. You can also select part of the prompt in a previously run block.

## Warp prompt

Warp has a native prompt that displays context chips showing information such as your current working directory, git branch, svn status, Kubernetes context, pyenv, date, and time. The Warp prompt is the default when **Input type** is set to **Warp**.
Warp's native prompt displays context chips for information such as your current working directory, Git branch, Subversion status, Kubernetes context, Python environment, date, and time. The Warp prompt is the default when **Input type** is set to **Warp**.

To customize which context chips your Warp prompt displays:

1. Right-click the prompt area and select **Edit prompt**.

<figure>
![Right-click context menu showing the Edit prompt option](../../../../assets/terminal/edit-prompt-modal.png)
<figcaption>Prompt editing via right-click.</figcaption>
</figure>

2. Select **Warp Prompt**.
3. Drag and drop context chips to configure which pieces of information your prompt displays.

{/* TODO: Add an updated screenshot of the Edit prompt chip customization view (drag-and-drop interface) here, and delete the outdated edit-prompt-modal (1).png from assets. */}
1. In the Warp app, open **Settings** > **Appearance**.
2. Under **Input**, click the prompt preview below **Input type**.
3. In **Edit prompt**, select **Warp terminal prompt**.
4. Drag context chips into the dashed box and arrange them in the order you want.
5. Click **Save changes**.

### Git and Subversion

Git and Subversion context chips show which branch you are on locally, as well as the number of uncommitted changed files. This includes any new files, modified files, and deleted files that are staged or unstaged.
Git and Subversion context chips show your local branch and uncommitted changes. Git chips can also show remote tracking status and diff statistics.

### Kubernetes

Expand All @@ -54,30 +46,17 @@ The Kubernetes context chip shows relevant information when you're using one of
Warp respects the `KUBECONFIG` environment variable. Make sure you set it to your preferred configuration file location if it's not the default path of `~/.kube/config`.
:::

{/* TODO: Same-line prompt was removed in the current release. May return in a future version (V2/V3). Uncomment when the feature ships. */}
{/* ### Same line prompt

By default, Warp's prompt displays on two lines where the command-line input is one line below the prompt.

To enable same-line prompt:

1. Right-click the prompt area and select **Edit prompt**.
2. Select **Warp Prompt**.
3. Check the box for **Same line prompt**. */}

## Shell prompt (PS1)

You can use a Shell prompt instead of the Warp prompt by configuring the **PS1** variable or installing a supported shell prompt plugin (see [Shell prompt compatibility table](/terminal/appearance/prompt/#shell-prompt-compatibility-table)).

To enable the Shell prompt:

1. Open **Settings** > **Appearance**.
1. In the Warp app, open **Settings** > **Appearance**.
2. Under **Input**, set **Input type** to **Shell (PS1)**.
3. Configure your PS1 variable in your shell's RC file, or install a supported prompt plugin.
3. Configure your `PS1` variable in your shell's RC file, or install a supported prompt plugin.

:::note
The PS1 is a variable used by the shell to generate the prompt, it represents the primary prompt string (hence the "PS") - which the terminal typically displays before typing new commands.
:::
`PS1` is the shell variable for the primary prompt string, which the terminal displays before your command-line input.

### Multi-line and right-sided prompts

Expand All @@ -96,7 +75,7 @@ echo -e '\nPROMPT="${PROMPT}"$'\''\\n'\''' >> ~/.zshrc
# Fish
echo -e '\nfunctions --copy fish_prompt fish_prompt_orig; function fish_prompt; fish_prompt_orig; echo; end' >> ~/.config/fish/config.fish

# Powershell
# PowerShell
$rawString = @'
$originalPrompt = Get-Item Function:\prompt
Set-Item -Path Function:\prompt_original -Value $originalPrompt
Expand All @@ -114,12 +93,6 @@ echo '[line_break]\ndisabled = false' >> ~/.config/starship.toml
```
:::

## How it works

<DemoVideo src="/assets/terminal/warp-custom-prompt-demo.mp4" label="Warp Prompt + Custom Prompt Demo" />

{/* Outdated screenshot removed; see TODO after step 3 in the Warp prompt section. */}

### Shell prompt compatibility table

| Shell | Tool | Does it work? |
Expand All @@ -143,76 +116,57 @@ echo '[line_break]\ndisabled = false' >> ~/.config/starship.toml

## Known incompatibilities

If you're having issues with prompts, see below or our [Known Issues](/support-and-community/troubleshooting-and-support/known-issues/#configuring-and-debugging-your-rc-files) for more troubleshooting steps.
If you have prompt issues, review the notes below and [debug your shell RC files](/support-and-community/troubleshooting-and-support/known-issues/#configuring-and-debugging-your-rc-files).

### Starship

#### Starship settings

Some `~/.config/starship.toml` settings are known to cause errors in Warp. `#` or `DEL` the following lines to resolve known errors:

```
# Get editor completions based on the config schema
'' = 'https://starship.rs/config-schema.json'
To keep a Starship prompt on one line, add the following to `~/.config/starship.toml`:

# Disables the custom module
[custom]
disabled = false
```

For `fish` shell, optional for `bash|zsh`, disable the multi-line prompt in Starship by putting the following in your `~/.config/starship.toml`:

```
```toml
[line_break]
disabled = true
```

You may also see an error relating to timeout. You can set the `command_timeout` variable in your `~/.config/starship.toml` to fix this. See more in the [starship docs](https://starship.rs/config/#prompt).
Set `disabled` to `false` to put the input on a new line. For other prompt-wide settings, including `command_timeout`, see the [Starship prompt configuration](https://starship.rs/config/#prompt).

#### Starship + bash

Starship prompt may not render properly if your [default shell](/getting-started/supported-shells/#changing-what-shell-warp-uses) is `/bin/bash`. To [workaround](https://github.com/warpdotdev/Warp/issues/3066#issuecomment-1548643121) the issue, we recommend you upgrade bash, find the path with `echo $(which bash)`, then put the path in **Settings** > **Features** > **Session** > **"Startup shell for new sessions"**.
Starship may not render properly if your [default shell](/getting-started/supported-shells/#changing-what-shell-warp-uses) is `/bin/bash`. To work around the issue, upgrade Bash, find its path with `command -v bash`, then select that path under **Settings** > **Features** > **Session** > **Default shell for new sessions** in the Warp app.

#### Starship + zsh

If you want to restore the additional line after the Starship prompt on `zsh`, add the following to the bottom of your `~/.zshrc` file: `PROMPT="${PROMPT}"$'\n'`
To put the input on a new line after the Starship prompt in zsh, add `PROMPT="${PROMPT}"$'\n'` to the bottom of `~/.zshrc`.

### Powerlevel10k

When installing the Powerlevel10k (P10k) prompt, we recommend you use the [Meslo Nerd Font](https://github.com/romkatv/powerlevel10k/blob/master/font.md).\
\
P10K may display the arrow dividers as grey instead of color. The color for those chars is rendered grey due to Warp's minimum contrast setting. To [workaround](https://github.com/warpdotdev/Warp/issues/2851#issuecomment-1605005256) this issue, go to **Settings** > **Appearance** > **Text** > **Enforce minimum contrast** and set it to "Never".
Powerlevel10k recommends the [Meslo Nerd Font](https://github.com/romkatv/powerlevel10k/blob/master/font.md).

<figure>
Powerlevel10k may display arrow dividers in gray because of Warp's minimum contrast setting. To work around the issue, go to **Settings** > **Appearance** > **Text** > **Enforce minimum contrast** and select **Never**.

<figure style={{ maxWidth: "563px" }}>
![Example of the grey dividers in p10k](../../../../assets/terminal/p10k-grey-arrow-prompt.png)
<figcaption>Example of the grey dividers in p10k.</figcaption>
</figure>

Warp does support [p10k](https://github.com/romkatv/powerlevel10k#installation) version 1.19.0 and above. Ensure you have the latest version installed and restart Warp after the installation/update of p10k. Then enable the custom prompt as stated [above](/terminal/appearance/prompt/#choosing-your-prompt-type) and it should work.

:::note
Warp still doesn't fully support some p10k features like transient prompt and visual features like gradients.
:::

<VideoEmbed url="https://www.youtube.com/watch?t=18s&v=dIV9Cso4Mi8" title="Installing Powerlevel10k" />
Warp supports [Powerlevel10k](https://github.com/romkatv/powerlevel10k#installation) version 1.19.0 and later. Install the latest version, restart Warp, then [switch to the Shell prompt](#choosing-your-prompt-type).

:::caution
The Installing Powerlevel10k video mentions enabling a custom prompt in **Settings** > **Features** > **Honor users custom prompt (PS1)**, but it's now in **Settings** > **Appearance** > **Input** > **Classic** > **Current prompt** > **Shell Prompt (PS1)**.
:::
Warp doesn't support some Powerlevel10k features, including transient prompts and gradients.

### Spaceship

This prompt can cause an issue with typeahead in Warp's input editor. To [workaround](https://github.com/warpdotdev/Warp/issues/1973#issuecomment-1340150521) the issue, run `echo "SPACESHIP_PROMPT_ASYNC=FALSE" >>! ~/.zshrc`.
This prompt can cause an issue with typeahead in Warp's input editor. To work around the issue, run `echo "SPACESHIP_PROMPT_ASYNC=FALSE" >>! ~/.zshrc`.

### Prezto

Although Warp does have support for prezto's prompt, enabling the [prezto utility module](https://github.com/sorin-ionescu/prezto/blob/master/modules/utility/README.md) in the `.zpreztorc` is not supported as with many other autocompletion [plugins that are incompatible](/support-and-community/troubleshooting-and-support/known-issues/#list-of-incompatible-tools).
Warp supports the Prezto prompt, but not the [Prezto utility module](https://github.com/sorin-ionescu/prezto/blob/master/modules/utility/README.md) or other [incompatible autocompletion plugins](/support-and-community/troubleshooting-and-support/known-issues/#list-of-incompatible-tools).

### Disabling unsupported prompts for Warp

We advise using Warp's default prompt or installing one of the supported tools, see [Compatibility Table](/terminal/appearance/prompt/#shell-prompt-compatibility-table). You can disable unsupported prompts for Warp as such:
Use Warp's default prompt or install a tool from the [Shell prompt compatibility table](#shell-prompt-compatibility-table). To disable an unsupported prompt only in Warp, wrap its setup in this condition:

```
```bash
if [[ $TERM_PROGRAM != "WarpTerminal" ]]; then
##### WHAT YOU WANT TO DISABLE FOR WARP - BELOW

Expand All @@ -224,9 +178,9 @@ fi

#### iTerm2

The iTerm2 shell integration breaks Warp and your custom prompt will not be able to be visible with this on. If you're coming from iTerm2, check your dotfiles for it. We advise disabling the integration for Warp like so:
The iTerm2 shell integration is incompatible with Warp and can hide your custom prompt. If you migrated from iTerm2, check your dotfiles and disable the integration in Warp:

```
```bash
if [[ $TERM_PROGRAM != "WarpTerminal" ]]; then
##### WHAT YOU WANT TO DISABLE FOR WARP - BELOW

Expand All @@ -235,3 +189,8 @@ test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell
##### WHAT YOU WANT TO DISABLE FOR WARP - ABOVE
fi
```

## Related pages

* [Supported shells](/getting-started/supported-shells/)
* [Configuring and debugging shell RC files](/support-and-community/troubleshooting-and-support/known-issues/#configuring-and-debugging-your-rc-files)
Loading