Skip to main content

Transient prompt

info

This feature only works in nu, fish, zsh, powershell (ConstrainedLanguage mode unsupported) and cmd for the time being.

Transient prompt, when enabled, replaces the prompt with a simpler one to allow more screen real estate. You can use go text/template templates extended with sprig to enrich the text. All template functionality is available, even reusing cross segment template properties from the previous primary prompt run.

Typically, your prompt will simply leave the prompt on the screen when you execute a command (or press enter) like so:

Before Transient

By enabling Transient Prompt, you can replace the prompt with some other content for a cleaner console as shown here:

After Transient

Configurationโ€‹

You need to extend or create a custom theme with your transient prompt. For example:

{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
...
],
"transient_prompt": {
"background": "transparent",
"foreground": "#ffffff",
"template": "{{ .Shell }}> "
}
}

Propertiesโ€‹

NameTypeDescription
foregroundstringcolor
foreground_templatesarraycolor templates
backgroundstringcolor
background_templatesarraycolor templates
templatestringa go text/template template extended with sprig utilizing the properties below - defaults to {{ .Shell }}>
fillerstringwhen you want to create a line with a repeated set of characters spanning the width of the terminal. Will be added after the template text

Enable the featureโ€‹

Oh My posh handles enabling the feature automatically for all shells except cmd when the config contains a transient prompt configuration. For cmd, you can run the command below once to enable the feature permanently:

clink set prompt.transient always