romkatv / powerlevel10k

A Zsh theme
MIT License
45.75k stars 2.16k forks source link

Error in new install: prompt_dir #82

Closed forrie closed 5 years ago

forrie commented 5 years ago

Just installed this on a fresh installation of oh-my-zsh, getting this error when switching to the Powerlevel10k theme:

prompt_dir:30: character not in range  ✔  564  13:37:12

romkatv commented 5 years ago

You probably need to add export LANG=<something> to the top of your ~/.zshrc. Try these values:

export LANG=en_US.UTF-8
export LANG=en_US.utf8
export LANG=C.UTF-8
forrie commented 5 years ago

This has no effect on the error, unfortunately.

romkatv commented 5 years ago

Try to combine it with export LC_ALL=<same-value>. If this doesn't help, then remove both lines, create a new terminal window, paste the following command and send me the output:

{
  locale
  uname -a
  typeset LANG ZSH_VERSION ZSH_PATCHLEVEL
  typeset -m LC_\*
  locale -a
}
forrie commented 5 years ago

This changed a bit. It still feels off. I can't post screenshots here, so here's a link to the prompt; a screenshot I took:

https://pasteboard.co/Iiv0n7g.png

So to clarify, in my .zshrc I now have:

export LANG=en_US.UTF-8 export LANG=en_US.utf8 export LANG=C.UTF-8 export LC_ALL=en_US.UTF-8 export LC_ALL=en_US.utf8 export LC_ALL=C.UTF-8

And here's the output:

Darwin Macbook-Pro-Home.local 18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64 LANG=C.UTF-8 ZSH_VERSION=5.7.1 ZSH_PATCHLEVEL=zsh-5.7.1-0-g8b89d0d LC_ALL=C.UTF-8 LC_TERMINAL_VERSION=3.3.0beta10 LC_TERMINAL=iTerm2 LC_CTYPE=C.UTF-8 en_NZ nl_NL.UTF-8 pt_BR.UTF-8 fr_CH.ISO8859-15 eu_ES.ISO8859-15 en_US.US-ASCII af_ZA bg_BG cs_CZ.UTF-8 fi_FI zh_CN.UTF-8 eu_ES sk_SK.ISO8859-2 nl_BE fr_BE sk_SK en_US.UTF-8 en_NZ.ISO8859-1 de_CH sk_SK.UTF-8 de_DE.UTF-8 am_ET.UTF-8 zh_HK be_BY.UTF-8 uk_UA pt_PT.ISO8859-1 en_AU.US-ASCII kk_KZ.PT154 en_US nl_BE.ISO8859-15 de_AT.ISO8859-1 hr_HR.ISO8859-2 fr_FR.ISO8859-1 af_ZA.UTF-8 am_ET fi_FI.ISO8859-1 ro_RO.UTF-8 af_ZA.ISO8859-15 en_NZ.UTF-8 fi_FI.UTF-8 hr_HR.UTF-8 da_DK.UTF-8 ca_ES.ISO8859-1 en_AU.ISO8859-15 ro_RO.ISO8859-2 de_AT.UTF-8 pt_PT.ISO8859-15 sv_SE fr_CA.ISO8859-1 fr_BE.ISO8859-1 en_US.ISO8859-15 it_CH.ISO8859-1 en_NZ.ISO8859-15 en_AU.UTF-8 de_AT.ISO8859-15 af_ZA.ISO8859-1 hu_HU.UTF-8 et_EE.UTF-8 he_IL.UTF-8 uk_UA.KOI8-U be_BY kk_KZ hu_HU.ISO8859-2 it_CH pt_BR ko_KR it_IT fr_BE.UTF-8 ru_RU.ISO8859-5 zh_TW zh_CN.GB2312 no_NO.ISO8859-15 de_DE.ISO8859-15 en_CA fr_CH.UTF-8 sl_SI.UTF-8 uk_UA.ISO8859-5 pt_PT hr_HR cs_CZ fr_CH he_IL zh_CN.GBK zh_CN.GB18030 fr_CA pl_PL.UTF-8 ja_JP.SJIS sr_YU.ISO8859-5 be_BY.CP1251 sr_YU.ISO8859-2 sv_SE.UTF-8 sr_YU.UTF-8 de_CH.UTF-8 sl_SI pt_PT.UTF-8 ro_RO en_NZ.US-ASCII ja_JP zh_CN fr_CH.ISO8859-1 ko_KR.eucKR be_BY.ISO8859-5 nl_NL.ISO8859-15 en_GB.ISO8859-1 en_CA.US-ASCII is_IS.ISO8859-1 ru_RU.CP866 nl_NL fr_CA.ISO8859-15 sv_SE.ISO8859-15 hy_AM en_CA.ISO8859-15 en_US.ISO8859-1 zh_TW.Big5 ca_ES.UTF-8 ru_RU.CP1251 en_GB.UTF-8 en_GB.US-ASCII ru_RU.UTF-8 eu_ES.UTF-8 es_ES.ISO8859-1 hu_HU el_GR.ISO8859-7 en_AU it_CH.UTF-8 en_GB sl_SI.ISO8859-2 ru_RU.KOI8-R nl_BE.UTF-8 et_EE fr_FR.ISO8859-15 cs_CZ.ISO8859-2 lt_LT.UTF-8 pl_PL.ISO8859-2 fr_BE.ISO8859-15 is_IS.UTF-8 tr_TR.ISO8859-9 da_DK.ISO8859-1 lt_LT.ISO8859-4 lt_LT.ISO8859-13 zh_TW.UTF-8 bg_BG.CP1251 el_GR.UTF-8 be_BY.CP1131 da_DK.ISO8859-15 is_IS.ISO8859-15 no_NO.ISO8859-1 nl_NL.ISO8859-1 nl_BE.ISO8859-1 sv_SE.ISO8859-1 pt_BR.ISO8859-1 zh_CN.eucCN it_IT.UTF-8 en_CA.UTF-8 uk_UA.UTF-8 de_CH.ISO8859-15 de_DE.ISO8859-1 ca_ES sr_YU hy_AM.ARMSCII-8 ru_RU zh_HK.UTF-8 eu_ES.ISO8859-1 is_IS bg_BG.UTF-8 ja_JP.UTF-8 it_CH.ISO8859-15 fr_FR.UTF-8 ko_KR.UTF-8 et_EE.ISO8859-15 kk_KZ.UTF-8 ca_ES.ISO8859-15 en_IE.UTF-8 es_ES de_CH.ISO8859-1 en_CA.ISO8859-1 es_ES.ISO8859-15 en_AU.ISO8859-1 el_GR da_DK no_NO it_IT.ISO8859-1 en_IE zh_HK.Big5HKSCS hi_IN.ISCII-DEV ja_JP.eucJP it_IT.ISO8859-15 pl_PL ko_KR.CP949 fr_CA.UTF-8 fi_FI.ISO8859-15 en_GB.ISO8859-15 fr_FR hy_AM.UTF-8 no_NO.UTF-8 es_ES.UTF-8 de_AT tr_TR.UTF-8 de_DE lt_LT tr_TR C POSIX

romkatv commented 5 years ago

I can't post screenshots here

You can drag-and-drop images to the edit box when commenting on GitHub. pasteboard.co also works, so up to you.

So to clarify, in my .zshrc I now have:

export LANG=en_US.UTF-8 export LANG=en_US.utf8 export LANG=C.UTF-8 export LC_ALL=en_US.UTF-8 export LC_ALL=en_US.utf8 export LC_ALL=C.UTF-8

Thanks for clarifying. You don't need to set the same variable more than once. Please replace these six lines with these two:

export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8

If after this the theme still doesn't work, it's likely a font problem. Have you installed a powerline font? If not, you can either install one or use Pure Power config. I cannot recommend the latter option enough. You'll avoid so many problems by using Pure Power config.

forrie commented 5 years ago

First, thanks for responding so quickly on a Saturday.

I installed all the fonts; I'm on a Mac (Mojave) so I just installed them all via Fontbook. I switched iTerm's font from Monaco to Robo Mono Medium for Powerlevel, I'm still getting some funky characters at the end (right) of the prompt.

Screen Shot 2019-06-08 at 2 59 50 PM
romkatv commented 5 years ago

This type of brokenness is interesting. I've never seen this before. Could you type get_icon_names and attach a screenshot of the output?

forrie commented 5 years ago

This is the output, below. It's referencing PowerLevel9k tho, where I set this to PowerLevel10k -- may just be naming and has no difference.

I'm using iTerm on MacOS, so not the default terminal app (which I loathe).

POWERLEVEL9K_ANDROID_ICON: And POWERLEVEL9K_APPLE_ICON: OSX POWERLEVEL9K_AWS_EB_ICON: 🌱 POWERLEVEL9K_AWS_ICON: AWS: POWERLEVEL9K_BACKGROUND_JOBS_ICON: ⚙ POWERLEVEL9K_BATTERY_ICON: 🔋 POWERLEVEL9K_CARRIAGE_RETURN_ICON: ↵ POWERLEVEL9K_DATE_ICON: POWERLEVEL9K_DISK_ICON: hdd POWERLEVEL9K_DROPBOX_ICON: Dropbox POWERLEVEL9K_ETC_ICON: ⚙ POWERLEVEL9K_EXECUTION_TIME_ICON: Dur POWERLEVEL9K_FAIL_ICON: ✘ POWERLEVEL9K_FOLDER_ICON: POWERLEVEL9K_FREEBSD_ICON: BSD POWERLEVEL9K_GO_ICON: Go POWERLEVEL9K_HOME_ICON: POWERLEVEL9K_HOME_SUB_ICON: POWERLEVEL9K_JAVA_ICON: ☕ POWERLEVEL9K_KUBERNETES_ICON: ⎈ POWERLEVEL9K_LARAVEL_ICON: POWERLEVEL9K_LEFT_SEGMENT_END_SEPARATOR: POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR:  POWERLEVEL9K_LEFT_SUBSEGMENT_SEPARATOR:  POWERLEVEL9K_LINUX_ALPINE_ICON: Alp POWERLEVEL9K_LINUX_AOSC_ICON: Aos POWERLEVEL9K_LINUX_ARCH_ICON: Arc POWERLEVEL9K_LINUX_CENTOS_ICON: Cen POWERLEVEL9K_LINUX_COREOS_ICON: Cor POWERLEVEL9K_LINUX_DEBIAN_ICON: Deb POWERLEVEL9K_LINUX_DEVUAN_ICON: Dev POWERLEVEL9K_LINUX_ELEMENTARY_ICON: Elm POWERLEVEL9K_LINUX_FEDORA_ICON: Fed POWERLEVEL9K_LINUX_GENTOO_ICON: Gen POWERLEVEL9K_LINUX_ICON: Lx POWERLEVEL9K_LINUX_MAGEIA_ICON: Mag POWERLEVEL9K_LINUX_MANJARO_ICON: Man POWERLEVEL9K_LINUX_MINT_ICON: LMi POWERLEVEL9K_LINUX_NIXOS_ICON: Nix POWERLEVEL9K_LINUX_OPENSUSE_ICON: OSu POWERLEVEL9K_LINUX_RASPBIAN_ICON: RPi POWERLEVEL9K_LINUX_SABAYON_ICON: Sab POWERLEVEL9K_LINUX_SLACKWARE_ICON: Sla POWERLEVEL9K_LINUX_UBUNTU_ICON: Ubu POWERLEVEL9K_LOAD_ICON: L POWERLEVEL9K_LOCK_ICON:  POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX: ╭─ POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX: ╰─ POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_PREFIX: ├─ POWERLEVEL9K_NETWORK_ICON: IP POWERLEVEL9K_NODE_ICON: ⬢ POWERLEVEL9K_OK_ICON: ✔ POWERLEVEL9K_PUBLIC_IP_ICON: POWERLEVEL9K_PYTHON_ICON: POWERLEVEL9K_RAM_ICON: RAM POWERLEVEL9K_RIGHT_SEGMENT_SEPARATOR:  POWERLEVEL9K_RIGHT_SUBSEGMENT_SEPARATOR:  POWERLEVEL9K_ROOT_ICON: ⚡ POWERLEVEL9K_RUBY_ICON: POWERLEVEL9K_RULER_CHAR: ─ POWERLEVEL9K_RUST_ICON: Rust POWERLEVEL9K_SERVER_ICON: POWERLEVEL9K_SSH_ICON: (ssh) POWERLEVEL9K_SUDO_ICON:  POWERLEVEL9K_SUNOS_ICON: Sun POWERLEVEL9K_SWAP_ICON: SWP POWERLEVEL9K_SWIFT_ICON: Swift POWERLEVEL9K_SYMFONY_ICON: SF POWERLEVEL9K_TEST_ICON: POWERLEVEL9K_TIME_ICON: POWERLEVEL9K_TODO_ICON: ☑ POWERLEVEL9K_VCS_BOOKMARK_ICON: ☿ POWERLEVEL9K_VCS_BRANCH_ICON: î‚ POWERLEVEL9K_VCS_COMMIT_ICON: POWERLEVEL9K_VCS_GIT_BITBUCKET_ICON: POWERLEVEL9K_VCS_GIT_GITHUB_ICON: POWERLEVEL9K_VCS_GIT_GITLAB_ICON: POWERLEVEL9K_VCS_GIT_ICON: POWERLEVEL9K_VCS_HG_ICON: POWERLEVEL9K_VCS_INCOMING_CHANGES_ICON: ↓ POWERLEVEL9K_VCS_LOADING_ICON: POWERLEVEL9K_VCS_OUTGOING_CHANGES_ICON: ↑ POWERLEVEL9K_VCS_REMOTE_BRANCH_ICON: → POWERLEVEL9K_VCS_STAGED_ICON: ✚ POWERLEVEL9K_VCS_STASH_ICON: ⍟ POWERLEVEL9K_VCS_SVN_ICON: POWERLEVEL9K_VCS_TAG_ICON: POWERLEVEL9K_VCS_UNSTAGED_ICON: ● POWERLEVEL9K_VCS_UNTRACKED_ICON: ? POWERLEVEL9K_VPN_ICON: (vpn) POWERLEVEL9K_WINDOWS_ICON: WIN

romkatv commented 5 years ago

Here's what I'm seeing in your reply:

broken

This looks broken. It's supposed to look like this:

working

Was it broken by GitHub or does it look broken in your terminal as well?

forrie commented 5 years ago

Yeah, it's definitely broken in my terminal. Not showing up like that at all. For testing, I opened up Terminal.app and this is what I see there, too. Some of it still seems off. It may be that there are multiple issues -- ie: with iTerm itself and a config in the system. I've not modified anything, I've always used iTerm and Monaco as the font.

POWERLEVEL9K_ANDROID_ICON: And POWERLEVEL9K_APPLE_ICON: OSX POWERLEVEL9K_AWS_EB_ICON: 🌱 POWERLEVEL9K_AWS_ICON: AWS: POWERLEVEL9K_BACKGROUND_JOBS_ICON: ⚙ POWERLEVEL9K_BATTERY_ICON: 🔋 POWERLEVEL9K_CARRIAGE_RETURN_ICON: ↵ POWERLEVEL9K_DATE_ICON: POWERLEVEL9K_DISK_ICON: hdd POWERLEVEL9K_DROPBOX_ICON: Dropbox POWERLEVEL9K_ETC_ICON: ⚙ POWERLEVEL9K_EXECUTION_TIME_ICON: Dur POWERLEVEL9K_FAIL_ICON: ✘ POWERLEVEL9K_FOLDER_ICON: POWERLEVEL9K_FREEBSD_ICON: BSD POWERLEVEL9K_GO_ICON: Go POWERLEVEL9K_HOME_ICON: POWERLEVEL9K_HOME_SUB_ICON: POWERLEVEL9K_JAVA_ICON: ☕ POWERLEVEL9K_KUBERNETES_ICON: ⎈ POWERLEVEL9K_LARAVEL_ICON: POWERLEVEL9K_LEFT_SEGMENT_END_SEPARATOR:
POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR:  POWERLEVEL9K_LEFT_SUBSEGMENT_SEPARATOR:  POWERLEVEL9K_LINUX_ALPINE_ICON: Alp POWERLEVEL9K_LINUX_AOSC_ICON: Aos POWERLEVEL9K_LINUX_ARCH_ICON: Arc POWERLEVEL9K_LINUX_CENTOS_ICON: Cen POWERLEVEL9K_LINUX_COREOS_ICON: Cor POWERLEVEL9K_LINUX_DEBIAN_ICON: Deb POWERLEVEL9K_LINUX_DEVUAN_ICON: Dev POWERLEVEL9K_LINUX_ELEMENTARY_ICON: Elm POWERLEVEL9K_LINUX_FEDORA_ICON: Fed POWERLEVEL9K_LINUX_GENTOO_ICON: Gen POWERLEVEL9K_LINUX_ICON: Lx POWERLEVEL9K_LINUX_MAGEIA_ICON: Mag POWERLEVEL9K_LINUX_MANJARO_ICON: Man POWERLEVEL9K_LINUX_MINT_ICON: LMi POWERLEVEL9K_LINUX_NIXOS_ICON: Nix POWERLEVEL9K_LINUX_OPENSUSE_ICON: OSu POWERLEVEL9K_LINUX_RASPBIAN_ICON: RPi POWERLEVEL9K_LINUX_SABAYON_ICON: Sab POWERLEVEL9K_LINUX_SLACKWARE_ICON: Sla POWERLEVEL9K_LINUX_UBUNTU_ICON: Ubu POWERLEVEL9K_LOAD_ICON: L POWERLEVEL9K_LOCK_ICON:  POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX: ╭─ POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX: ╰─ POWERLEVEL9K_MULTILINE_NEWLINE_PROMPT_PREFIX: ├─ POWERLEVEL9K_NETWORK_ICON: IP POWERLEVEL9K_NODE_ICON: ⬢ POWERLEVEL9K_OK_ICON: ✔ POWERLEVEL9K_PUBLIC_IP_ICON: POWERLEVEL9K_PYTHON_ICON: POWERLEVEL9K_RAM_ICON: RAM POWERLEVEL9K_RIGHT_SEGMENT_SEPARATOR:  POWERLEVEL9K_RIGHT_SUBSEGMENT_SEPARATOR:  POWERLEVEL9K_ROOT_ICON: ⚡ POWERLEVEL9K_RUBY_ICON: POWERLEVEL9K_RULER_CHAR: ─ POWERLEVEL9K_RUST_ICON: Rust POWERLEVEL9K_SERVER_ICON: POWERLEVEL9K_SSH_ICON: (ssh) POWERLEVEL9K_SUDO_ICON:  POWERLEVEL9K_SUNOS_ICON: Sun POWERLEVEL9K_SWAP_ICON: SWP POWERLEVEL9K_SWIFT_ICON: Swift POWERLEVEL9K_SYMFONY_ICON: SF POWERLEVEL9K_TEST_ICON: POWERLEVEL9K_TIME_ICON: POWERLEVEL9K_TODO_ICON: ☑ POWERLEVEL9K_VCS_BOOKMARK_ICON: ☿ POWERLEVEL9K_VCS_BRANCH_ICON:  POWERLEVEL9K_VCS_COMMIT_ICON: POWERLEVEL9K_VCS_GIT_BITBUCKET_ICON: POWERLEVEL9K_VCS_GIT_GITHUB_ICON: POWERLEVEL9K_VCS_GIT_GITLAB_ICON: POWERLEVEL9K_VCS_GIT_ICON: POWERLEVEL9K_VCS_HG_ICON: POWERLEVEL9K_VCS_INCOMING_CHANGES_ICON: ↓ POWERLEVEL9K_VCS_LOADING_ICON: POWERLEVEL9K_VCS_OUTGOING_CHANGES_ICON: ↑ POWERLEVEL9K_VCS_REMOTE_BRANCH_ICON: → POWERLEVEL9K_VCS_STAGED_ICON: ✚ POWERLEVEL9K_VCS_STASH_ICON: ⍟ POWERLEVEL9K_VCS_SVN_ICON: POWERLEVEL9K_VCS_TAG_ICON: POWERLEVEL9K_VCS_UNSTAGED_ICON: ● POWERLEVEL9K_VCS_UNTRACKED_ICON: ? POWERLEVEL9K_VPN_ICON: (vpn) POWERLEVEL9K_WINDOWS_ICON: WIN

Here's what the prompt looks like in Terminal.app:

Screen Shot 2019-06-08 at 3 19 46 PM
romkatv commented 5 years ago

OK, we have different issues here. The first is that your iTerm cannot display unicode characters, even those that don't require patched fonts. This isn't related to Powerlevel10k or even ZSH. You can try the following. Run bash from iTerm and type echo $'\u2714'. It should output heavy check mark. If it doesn't, you need to figure out a way to fix it. I'm not a Mac user, so I'm of little help here.

The problem with Terminal.app is more mundane and something I've seen many times. The font isn't Powerline. Once again, you can either install a Powerline font or (very highly recommended) use a config that doesn't require a Powerline font and is also better on pretty much every metric. You can apply it by running these commands:

( cd && curl -fsSLO https://raw.githubusercontent.com/romkatv/dotfiles-public/master/.purepower )
echo 'source ~/.purepower' >>! ~/.zshrc

Once you do this, you'll get a functional font in Terminal.app.

forrie commented 5 years ago

iTerm has a character encoding config available. Mine is set to "Western (ASCII)" which is probably the problem. But there are a ton of options including unicode. I don't know which Unicode to set it to, tho.

Screen Shot 2019-06-08 at 3 39 52 PM
romkatv commented 5 years ago

Try UTF-8. Also delete the export lines from your ~/.zshrc config that you added earlier. They shouldn't be necessary if your terminal is set up correctly.

forrie commented 5 years ago

I performed the CURL above for Terminal.app, and it seemed to do something, but I ended up with just a prompt of "> ".

Afterward I tried ZSH from iTerm and got this:

Screen Shot 2019-06-08 at 4 08 42 PM

I guess I'm just not going to be able to use this one LOL Or I need to dig more with iTerm and figure out what its problem is.

romkatv commented 5 years ago

I performed the CURL above for Terminal.app, and it seemed to do something, but I ended up with just a prompt of "> ".

Could you send a screenshot of this prompt?

Afterward I tried ZSH from iTerm and got this:

iTerm still cannot display unicode characters. Before attempting to use Powerlevel10k from iTerm, please first ensure that the terminal can print unicode characters. First, type bash. Then type echo $'\u2714'. It should output heavy check mark. If it doesn't, there is a problem in your terminal that is not related to Powerlevel10k or ZSH. You have to fix it.

forrie commented 5 years ago

I appear to have goofed the UTF-8 mod. I didn't do this for the default "shell" profile, which I just did and now I get the check mark. You can see the prompt I have now here:

Screen Shot 2019-06-08 at 4 16 18 PM
romkatv commented 5 years ago

Good! It works now. The prompt looks as expected. You can find the description of every prompt element here: https://github.com/romkatv/dotfiles-public/blob/master/.purepower#L33. You can modify your local copy of ~/.purepower to customize it, although even with the default config it's a great prompt.

forrie commented 5 years ago

Awesome. Thank you for your help (and patience).

romkatv commented 5 years ago

Glad to be of help!