Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Prompts with emoji issues



You need to fix typos in your prompt. Start with this:

  toon=$'\U1F479'
  PROMPT=$toon' %F{blue}%n@%m%f %F{green}%#%f '
  RPROMPT='%F{green}[%T]%f [%~]'

Note that I've replaced 👹 with $'\U1F479'. This is intentional. It's
meant to trigger an error if your locale is misconfigured. If you get
an error saying "zsh: character not in range", your locale isn't
UTF-8. You need to make it UTF-8.

This $toon is a wide unicode character, meaning that it takes 2
columns when printed. Some terminals have bugs that prevent them from
properly rendering such characters. You can check whether you terminal
can render $toon correctly with this command:

  print -r ${(l:${(m)#toon}:: :)}$'XYZ\n'$toon' ^-- must point to Y'

If the arrow points to Y, all is well. If it points to X or Z, either
your terminal is broken or unicode data used by zsh is incorrect. You
can employ a workaround to display $toon correctly nevertheless.

If the arrow points to X:

  toon=$'%{%2G\U1F479 %}'
  PROMPT=...
  RPROMPT=...

If the arrow points to Z:

  toon=$'%{%2G\U1F479%}'
  PROMPT=...
  RPROMPT=...

Roman.



Messages sorted by: Reverse Date, Date, Thread, Author