Skip to content
This repository has been archived by the owner on Apr 24, 2020. It is now read-only.

Troubleshooting

Kenny Tang edited this page Mar 25, 2019 · 46 revisions

Here are some fixes to some common problems.

Gaps Between Segments

You can see this issue in the screenshot, below:

Thankfully, this is easy to fix. This happens if you have successfully installed Powerline fonts, but did not make a Powerline font the default font in your terminal emulator (e.g., 'terminator', 'gnome-terminal', 'konsole', etc.,).

Segment Colors are Wrong

If the color display within your terminal seems off, it's possible you are using a reduced color set. You can check this by invoking echotc Co in your terminal, which should yield 256. If you see something different, try setting xterm-256color in your ~/.zshrc:

TERM=xterm-256color

Segment Separators are Wrong Color

If the segment separators in your prompt are a different shade than the segments themselves, like this:

then the issue is your terminal emulator. This issue is most common in OSX's default Terminal application. If you are on OSX, you will need to use an alternative emulator, like iTerm2 to see the proper colors.

This may also happen, if use iTerm and did not set your minimum contrast settings to zero:

Or if you have a transparency set without checking 'Keep background colors opaque'

Strange Characters in Prompt

If your prompt shows strange character like this:

it is most likely that you set POWERLEVEL9K_MODE="awesome-patched", but did not install an awesome-terminal-font. For most other modes, you need a powerline-patched font.

Character duplication on completion

This happens if your terminal does not use a correct encoding. To fix this in iTerm, got to iTerm Preferences > Profiles > Text and tick Use Unicode Version 9 Width.

Wrong Icons in prompt

a.k.a. "Mediumgate". If you use POWERLEVEL9K_MODE="awesome-fontconfig" and some icons are wrong (like status showing the green Medium.com-"M" instead of a checkmark, this is most likely because the codepoints of your font changed. We try to fix these as soon as we discover that fonts have changed codepoints, and updating your Powerlevel9k code should solve the problem (see #382 for an example).

Strange Characters in a Segment Icon / Multiline Prompt Prefix

If you are seeing strings like this \uXXXX (where the XXXX are digits and letters), you need to change the way you declared your icon / prefix. In order to show a Unicode character and not the string, you have to use $'\uXXX', e.g.

P9K_MULTILINE_FIRST_PROMPT_PREFIX_ICON=$'Prompt \uF054 '

instead of

P9K_MULTILINE_FIRST_PROMPT_PREFIX_ICON='\uF054 '   # this line won't work correctly
P9K_MULTILINE_FIRST_PROMPT_PREFIX_ICON="\uF054 "   # neither will this line

Strange Character / Segment Spacing

If your prompt looks like this:

It's likely you are using iTerm2 and have "Double-Width Characters" enabled. Be sure this setting is disabled.

Icons are cut off

If you notice cut off icons like this:

It's probably because your terminal emulator is not capable of displaying double-width glyphs. KDEs Konsole is well known for such a behaviour. Luckily there is a workaround for that. Try adding a whitespace after the code point, example: POWERLEVEL9K_HOME_SUB_ICON=$'\UE18D ' # <- Whitespace added. You can get a list of all icons by calling get_icon_names.

Background transparency

Some terminal emulators have a feature to reduce the opacity of the background. That does not play with powerline-like shell themes, because the segment separators are print in the foreground (so, are like text) and the transparency feature just adjusts the opacity of the background. So your segments will look like this:

Best fix: Some terminal emulators, like iTerm, allow you to keep background colors opaque while still making the terminal background transparent. See the checkbox in this screenshot:

Next best fix: Reduce the transparency in the settings of your terminal emulator (screenshot from iTerm):

Broken Umlauts/UTF-8 characters

If you use a language other than English, it is quite likely that you set your computers locale to your own language. To display the icons in the P9k prompt correctly we must set a default locale. We chose en_US.utf8, because it is probably the most widespread locale in use. So, it might happen that you have en_US.utf8 not installed, which will break your local characters. Folder names will appear like this:

To fix this problem, please install en_US.utf8. Don't worry, you do not have to overwrite your own locale. To get a list of installed locales, type locale -a.

Gap After Right Prompt

Right Prompts (RPROMPTs) in ZSH have a gap between the last character of the prompt and the edge of your terminal emulator. You can see this in the image, below, where the top line is P9k and the bottom line is tmux:

Unfortunately, as explained here, this is a bug in ZSH. The workaround is to set ZLE_RPROMPT_INDENT=0, but this has the side effect of shifting your cursor when you press TAB (see #364).

Terminal Starts with Error Code in Status Segment

If your terminal opens new windows or tabs reporting an error, which then goes away when you execute a command, it's usually something in your ZSH startup.

powerlevel9k error when startup

To figure out what is generating a failure code, add set -xe to your .zshrc and restart your terminal.

This was discovered in this StackOverflow question.

Deletion of Characters when Tab-Completing

If, when tab-completing, your prompt deletes characters / lines, and you are an Oh-My-ZSH user, try disabling the COMPLETION_WAITING_DOTS option in your zshrc, per this issue discussion.

Turn off $LANG and Colors Checking

If you need to disable terminal $LANG and colors checks in P9k, you can do so by defining these environment variables in your zshrc:

export POWERLEVEL9K_IGNORE_TERM_COLORS=false
export POWERLEVEL9K_IGNORE_TERM_LANG=false

~/.zshrc:N: character not in range

original issue

This error for some reason happens only when trying to ssh to host with powerlevel9k configured. If this error happens, then all the configuration variables following after the line N will be ignored and/or messed up..

The Error rendering results in that case look somewhat like this:

ssh_incorrect

Expected results:

correct

This happens because custom config variables set this way:

...
POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR=$'\uE0B0'
...

Although, IT RENDERS THE THEME PROPERLY (That is why it is so hard to find out), it must be set like:

...
POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR="\uE0B0"
...

Otherwise it returns the error above... Also, if it is set properly, but the error still appears (happens on Debian), then it is a locale problem which can be fixed by regenerating locales as described here. Please install en_US.utf8 locale as well.

Print Icon Function Not Working

Some segments (e.g. dir) advise to use the print_icon function, to change a default icon. Use this can lead to the error message command not found: print_icon, depending on your runtime configuration. This is caused by the fact that you have used the function within your configurations before P9K get sourced and the function definition can be found.
To handle this issue you should source the P9K main file on your own and define the configurations for it afterwards. This is possible, cause P9K will load the segment configuration just at runtime when a new prompt is opened. This is not the fact for the POWERLEVEL9K_MODE definition. This have to be placed before P9K get sourced.

To bring it down:

  • Source P9K on your own to have control where it will be loaded.
  • Define the mode variable before source P9K.
  • Configurations that use functions from P9K itself have to be defined after sourcing it.
  • All other configurations doesn't bother where they are defined.

Example Configuration:

POWERLEVEL9K_MODE="<mode>"
source $HOME/<where you placed p9k>/powerlevel9k.zsh-theme
POWERLEVEL9K_DIR_PATH_SEPARATOR=" $(print_icon 'LEFT_SUBSEGMENT_SEPARATOR') "

Furthermore it has to be mentioned, that using print_icon require the name of the icon variable name. By this it does not have a leading POWERLEVEL9K_ in front of the variable name. This could be perplexing, but print_icon will extend the given variable name automatically. So using the prefix would lead to POWERLEVEL9K_POWERLEVEL9K_... what does simply not exist.

Print_icon not found in Arch Linux

This issue has also been found in Arch Linux. Be sure to verify that your locale is set correctly. In LXC for example this is not done by default. Uncomment your locale in /etc/locale.gen, then run locale-gen and add your locale to /etc/locale.conf, as shown in the Arch Wiki. The comments in issue 639 may be of interest as well.

P9k in the VSCode Terminal

To use P9k in VSCode, install a powerline font and then configure VSCode to use it, as explained in this comment. You can use a configuration like this in your settings.json for VSCode:

{
  "terminal.external.osxExec": "iTerm.app",
  "terminal.integrated.cursorBlinking": true,
  "terminal.integrated.enableBold": true,
  "terminal.integrated.fontFamily": "MesloLGL Nerd Font",
  "terminal.integrated.fontSize": 14,
  "terminal.integrated.rightClickCopyPaste": true,
}

Issues with Awesome-Terminal-Fonts having ? in prompts.

One note on Awesome-Terminal-Fonts: they do not come with the powerline icons (the segment-separator triangles) included. If you do not use a base font that has them already included, you have to include them yourself. One option for doing this is to copy the original powerline font into ~/.fonts (and to configure it in your fontconfig-configuration, of course). You will need to configure them as a fallback font as you did for the rest of the fonts in these detailed instructions.