Skip to main content

FAQ

Before validating anything, make sure you're on the latest version of Oh My Posh and your terminal and shell are up-to-date.

My prompt is broken after upgrading to PowerShell 7.4โ€‹

PowerShell 7.4 has an issue in encoding which affects the rendering of Oh My Posh. You can work around this by forcing the entire shell to UTF8.

[Console]::OutputEncoding = [Text.Encoding]::UTF8
oh-my-posh init pwsh --config ~/custom.omp.json | Invoke-Expression
warning

Forcing the entire session to UTF8 can have unwanted side effects for other executables. We can't be held liable for that, consider this a temporary workaround until the original PowerShell issue is resolved.

I want to disable the upgrade noticeโ€‹

You can disable the upgrade notice using the following command once:

oh-my-posh disable notice

If you want to enable it again, run:

oh-my-posh enable notice

The prompt is slow (delay in showing the prompt between commands)โ€‹

Windows

The delay you're experiencing may be linked to the real-time protection features of antivirus software.

To potentially alleviate this delay, ensure that Windows Defender or your primary antivirus software has an exclusion set for the full path of the executable. To identify the full path of the executable in question, you can run the following command in a PowerShell prompt:

(Get-Command oh-my-posh).Source

Additionally, check your antivirus settings for features that actively scan scripts during execution. Even with exclusions set, some antivirus programs might still actively scan scripts, which can introduce a noticeable delay.

caution

Always proceed with caution to maintain a balance between system performance and security. Modifying security settings or adding exclusions can expose your system to potential threats.

You can use the oh-my-posh debug functionality to see where Oh My Posh spends its time. In case there's no clear culprit (timings indicate everything's OK), chances are some modules are the culprit. We bootstrap a few PowerShell modules to maximize compatibility, but sometimes these can introduce unwanted side-effects.

The modules we support are:

  • posh-git

If only your Git repo paths are slow, then try running git gc to clean up and optimize the local repository.

If nothing seems to resolve the issue, feel free to create an issue.

There are rectangles instead of icons in my promptโ€‹

The font you're using doesn't have the needed standard extended glyph set like Nerd Font does. Windows Terminal ships with Cascadia Code by default which has a powerline patched variant called Cascadia Code PL, but also that one misses certain interesting icons. You can fall back to any theme with the .minimal indication, or make use of a Nerd Font. Have a look at the font section for more context in case you're using all the right conditions.

Text decoration styles like bold and dimmed don't workโ€‹

The text decoration styles are based on your terminal emulator's capabilities.

A quick way to check if your terminal supports a specific style escape sequence is to take a look at the terminfo database, on Linux. Refer this page on ArchWiki.

If you are on Windows, use Windows Terminal. It closely copies the xterm-256color capabilities. See the PowerShell docs on terminal support and this GitHub comment.

Windows Terminal: Unexpected space between segments/textโ€‹

Windows Terminal has some issues with rendering certain glyphs. These issues are on their backlog. A temporary workaround is to use an invisible character at the end (\u2800), or a zero width character (\u200a) before the icon.

In case you didn't export the config yet (it's the default, or you're using the --config flag with a predefined theme), you can follow the steps here to export it to a local file so you can adjust the segment's template.

In the example below, it's assumed that the execution segment's icon \ueba2 has an unexpected space after it in Windows Terminal.

{
"type": "executiontime",
"template": "๎ฎข"
}

Adjust it by adding \u2800 immediately after the icon.

{
"type": "executiontime",
"template": "๎ฎขโ €"
}

Jetbrains terminals: Icons do not renderโ€‹

They need to work on their terminal, somehow it only supports UTF-8 and not UTF-16. An issue is available for a follow-up here.

Strange colouring after exiting VIM or when using the PowerShell progress bootstrapโ€‹

This bug is caused by Windows Terminal and/or VIM. There are two issues for this, one at Windows Terminal and one at VIM.

Conda: environment name displayed in front of the promptโ€‹

Conda will automatically prepend the prompt with the name of the environment you're in. To solely rely on Oh My Posh to set the prompt, you can configure the following setting to hide it. Make sure to add this before initializing Oh My Posh.

conda config --set changeps1 False

Python venv: Prompt changes on activating virtual environmentโ€‹

Virtual environments created with venv add the active environment's name to the prompt automatically. To disable this behaviour, set VIRTUAL_ENV_DISABLE_PROMPT environment variable to 1 on your system. Example files:

Note: Tilde (~) in paths refers to your user's home directory.

# Your PowerShell $PROFILE
$env:VIRTUAL_ENV_DISABLE_PROMPT=1

PowerShell: The term 'Set-Theme' is not recognized as the name of a cmdlet, function, script file, or operable program.โ€‹

You need to migrate using the following guide.

PowerShell: Running in ConstrainedLanguage modeโ€‹

You're here because you've seen the following message:

[WARNING] ConstrainedLanguage mode detected, unable to set console to UTF-8.
When using PowerShell in ConstrainedLanguage mode, please set the
console mode manually to UTF-8. See here for more information:
https://ohmyposh.dev/docs/faq#powershell-running-in-constrainedlanguage-mode

When running PowerShell in ConstrainedLanguage mode, we can't set the console to UTF-8. This will cause the prompt to be rendered incorrectly. There's a few options to set the console to UTF-8 from an OS perspective on Windows, other systems shouldn't be impacted.

To remove the message after manual configuration, you can add the following to your $PROFILE before importing Oh My Posh:

$env:POSH_CONSTRAINED_LANGUAGE = 1

PowerShell: The term '.../oh-my-posh.exe' is not recognized as a name of a cmdlet...โ€‹

For example:

&: The term 'C:/Users/TommiGrโ”œโ•ขnlund/.oh-my-posh/oh-my-posh.exe' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

The issue is that PowerShell on Windows doesn't yet default to UTF-8. Resolve the issue by setting the shell to UTF-8 in the scope of initializing Oh My Posh.

Why it matters?

If the location contains non-ASCII characters, non-UTF-8 PowerShell may provide a wrong path to Oh My Posh, which can break the initialization.

The scenario for non-ASCII location:

  • Your computer has a non-ASCII username.
  • Your config file is under your $HOME.

To do so, edit your $PROFILE, find the line that initializes Oh My Posh (as highlighted below), and change it to the following:

$previousOutputEncoding = [Console]::OutputEncoding
[Console]::OutputEncoding = [Text.Encoding]::UTF8
try {
oh-my-posh init pwsh --config ~/custom.omp.json | Invoke-Expression
} finally {
[Console]::OutputEncoding = $previousOutputEncoding
}

Alternatively, let the whole shell become UTF-8. (Be aware: Unwanted side effects can happen.) Add the following line to the top of your $PROFILE:

$OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = New-Object System.Text.UTF8Encoding

Zsh: No command history (Ctrl+R does not work)โ€‹

This issue occurs when you're using plain zsh in combination with Oh My Posh. You can fix this by adding the right configuration to ~/.zshrc.

HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
setopt appendhistory

ZSH: No such shell function 'zle-line-init'โ€‹

This is most likely caused by two Oh My Posh init lines in your .zshrc, remove one of them. See here.

Fish: Display current bind (Vim) modeโ€‹

By default, Oh My Posh will not re-render the prompt (i.e., generate a new prompt) until a new command is run, so you should export $fish_bind_mode to FISH__BIND_MODE and call the omp_repaint_prompt function to do prompt re-rendering when $fish_bind_mode changes:

function rerender_on_bind_mode_change --on-variable fish_bind_mode
if test "$fish_bind_mode" != paste -a "$fish_bind_mode" != "$FISH__BIND_MODE"
set -gx FISH__BIND_MODE $fish_bind_mode
omp_repaint_prompt
end
end

Next, mask the fish_default_mode_prompt function to prevent it from echoing the current mode:

function fish_default_mode_prompt --description "Display vi prompt mode"
# This function is masked and does nothing
end

After that, you can use the value in a template. The following replicates the example in the Fish documentation:

{
"type": "text",
"template": "{{ if eq .Env.FISH__BIND_MODE \"default\" }}<red>[N]</>{{ else if eq .Env.FISH__BIND_MODE \"insert\" }}<green>[I]</>{{ else if eq .Env.FISH__BIND_MODE \"replace_one\" }}<green>[R]</>{{ else if eq .Env.FISH__BIND_MODE \"visual\"}}<brmagenta>[V]</>{{ else }}<red>[?]</>{{ end }}"
}

Fish: Integrate with Alt+โ† and Alt+โ†’ Bindings to prevd and nextdโ€‹

Fish supports using Alt+โ† (Alt+Left) and Alt+โ†’ (Alt+Right) bindings to navigate the directory history.

To have oh-my-posh update the directory context as the directory history is navigated, use a function that calls omp_repaint_prompt when the $PWD variable changes:

function rerender_on_dir_change --on-variable PWD
omp_repaint_prompt
end

After updating my Nerd Font to a newer version, the prompt displays unknown charactersโ€‹

Nerd Fonts moved the icons to a different location in the font for v3. This can cause the prompt to display unknown characters. There's a built-in migration in Oh My Posh to fix this.

To migrate, run the following command:

oh-my-posh config migrate glyphs --write

This will update your configuration file to use the new glyph locations. Do know they might look different, as they also updated the icons themselves. A backup of the current config can be found in the same location with a .bak extension.

Xonsh: Right prompt jumps to bottom of the screenโ€‹

This is a known problem with Xonsh. The issue is tracked here.