romkatv / powerlevel10k

A Zsh theme
MIT License
46.42k stars 2.19k forks source link

Encountering an error trying to load powerlevel10k with oh-my-zsh #10

Closed jsonMartin closed 5 years ago

jsonMartin commented 5 years ago

Hi, I'm using oh-my-zsh, and I can't get this to work.

This is the error I'm getting: ~/.oh-my-zsh/custom/themes/powerlevel10k/powerlevel10k.zsh-theme:77: unknown condition: -v

I've tried to both add the source ~/.oh-my-zsh/custom/themes/powerlevel10k/powerlevel10k.zsh-theme, as well as doing it the oh-my-zsh way of setting ZSH_THEME="powerlevel10k/powerlevel10k". Both are giving me the same error.

Any help would be appreciated, looking forward to trying this!

romkatv commented 5 years ago

We can sort it but I'll need a bit more info. Please run the following command and send me its complete output.

zsh -ic 'uname -a && zsh --version && set | grep -E "^POWERLEVEL9K"' 2>&1
romkatv commented 5 years ago

@jsonMartin I can fix the issue if you could provide the information I asked for.

jsonMartin commented 5 years ago

Hi @romkatv , here's the output from the command:

Linux DESKTOP-UJTUCJH 4.4.0-17763-Microsoft #253-Microsoft Mon Dec 31 17:49:00 PST 2018 x86_64 x86_64 x86_64 GNU/Linux
zsh 5.1.1 (x86_64-ubuntu-linux-gnu)
Binary file (standard input) matches
romkatv commented 5 years ago

Your zsh is very old. You need at least version 5.2. Please run sudo apt update -y && sudo apt upgrade -y.

romkatv commented 5 years ago

I highly recommending upgrading to Ubuntu 18.04. You can either nuke the current distribution and install the new "ubuntu" distribution in WSL from scratch, or do an inplace upgrade (backup important data first!):

sudo bash -xc "
  apt-get update -y &&
  apt upgrade -y &&
  apt-mark hold procps strace sudo &&
  RELEASE_UPGRADER_NO_SCREEN=1 do-release-upgrade"

The last step will take a while.

jsonMartin commented 5 years ago

@romkatv OK, I tried the apt update and upgrade commands, but after doing all of that it says that my zsh is at the newest version: zsh is already the newest version (5.1.1-1ubuntu2.3).

Upgrading to 18.04 sounds like a good idea, I will look into doing that when I have some time and a better internet connection. If I install from scratch, I'm assuming I will have to re-install all my linux packages?

romkatv commented 5 years ago

If I install from scratch, I'm assuming I will have to re-install all my linux packages?

Yes. If the only thing you need to reinstall is the packages, then I think it'll be faster to reinstall the whole distro. It's more reliable, too.

romkatv commented 5 years ago

I documented that zsh prior to 5.2 isn't supported. Closing the issue. Please reopen if Powerlevel10k still don't work after you upgrade zsh.

nullset2 commented 5 years ago

Ran into this with zsh 5.7 and the latest oh-my-zsh:

zsh 5.7.1 (x86_64-apple-darwin16.7.0)
POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=false
POWERLEVEL9K_ALWAYS_SHOW_USER=false
POWERLEVEL9K_ANACONDA_LEFT_DELIMITER='('
POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER=')'
POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE=true
POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE_ALWAYS=false
POWERLEVEL9K_BATTERY_HIDE_ABOVE_THRESHOLD=999
POWERLEVEL9K_BATTERY_LEVEL_BACKGROUND=(  )
POWERLEVEL9K_BATTERY_LOW_THRESHOLD=10
POWERLEVEL9K_BATTERY_STAGES=''
POWERLEVEL9K_BATTERY_VERBOSE=true
POWERLEVEL9K_CHANGESET_HASH_LENGTH=6
POWERLEVEL9K_CHRUBY_SHOW_ENGINE=true
POWERLEVEL9K_CHRUBY_SHOW_VERSION=true
POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=2
POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=3
POWERLEVEL9K_CONTEXT_DEFAULT_BACKGROUND=black
POWERLEVEL9K_CONTEXT_DEFAULT_FOREGROUND=yellow
POWERLEVEL9K_CONTEXT_TEMPLATE=%n@%m
POWERLEVEL9K_CUSTOM_CHECK_REMITTANCES='echo  Ex/Ec: $(~/scripts/check_remittances.sh)'
POWERLEVEL9K_CUSTOM_CHECK_REMITTANCES_BACKGROUND=green
POWERLEVEL9K_CUSTOM_CHECK_REMITTANCES_FOREGROUND=black
POWERLEVEL9K_DATE_FORMAT='%D{%d.%m.%y}'
POWERLEVEL9K_DIR_HOME_BACKGROUND=blue
POWERLEVEL9K_DIR_HOME_FOREGROUND=black
POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=false
POWERLEVEL9K_DIR_PACKAGE_FILES=( package.json composer.json )
POWERLEVEL9K_DIR_PATH_ABSOLUTE=false
POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=false
POWERLEVEL9K_DIR_PATH_SEPARATOR=/
POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND=''
POWERLEVEL9K_DIR_SHOW_WRITABLE=false
POWERLEVEL9K_DISABLE_GITSTATUS=false
POWERLEVEL9K_DISABLE_RPROMPT=false
POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL=95
POWERLEVEL9K_DISK_USAGE_ONLY_WARNING=false
POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL=90
POWERLEVEL9K_EXPERIMENTAL_TIME_REALTIME=false
POWERLEVEL9K_HIDE_BRANCH_ICON=false
POWERLEVEL9K_HOME_FOLDER_ABBREVIATION='~'
POWERLEVEL9K_HOST_TEMPLATE=%m
POWERLEVEL9K_IGNORE_TERM_COLORS=false
POWERLEVEL9K_IGNORE_TERM_LANG=false
POWERLEVEL9K_IP_INTERFACE='^[^ ]+'
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=( status context dir vcs )
POWERLEVEL9K_LOAD_WHICH=5
POWERLEVEL9K_MAX_CACHE_SIZE=10000
POWERLEVEL9K_MODE=awesome-patched
POWERLEVEL9K_PROMPT_ADD_NEWLINE=false
POWERLEVEL9K_PROMPT_ON_NEWLINE=false
POWERLEVEL9K_PUBLIC_IP_FILE=/tmp/p9k_public_ip
POWERLEVEL9K_PUBLIC_IP_HOST=http://ident.me
POWERLEVEL9K_PUBLIC_IP_METHODS=( dig curl wget )
POWERLEVEL9K_PUBLIC_IP_NONE=''
POWERLEVEL9K_PUBLIC_IP_TIMEOUT=300
POWERLEVEL9K_PUBLIC_IP_VPN_INTERFACE=''
POWERLEVEL9K_PYENV_PROMPT_ALWAYS_SHOW=false
POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW=false
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(  )
POWERLEVEL9K_SHORTEN_DELIMITER=''
POWERLEVEL9K_SHORTEN_DIR_LENGTH=1
POWERLEVEL9K_SHORTEN_FOLDER_MARKER=.shorten_folder_marker
POWERLEVEL9K_SHORTEN_STRATEGY=truncate_from_right
POWERLEVEL9K_SHOW_CHANGESET=true
POWERLEVEL9K_STATUS_CROSS=false
POWERLEVEL9K_STATUS_ERROR_BACKGROUND=black
POWERLEVEL9K_STATUS_ERROR_FOREGROUND=red
POWERLEVEL9K_STATUS_HIDE_SIGNAME=false
POWERLEVEL9K_STATUS_OK=true
POWERLEVEL9K_STATUS_OK_BACKGROUND=black
POWERLEVEL9K_STATUS_OK_FOREGROUND=green
POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE=false
POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=true
POWERLEVEL9K_STATUS_VERBOSE=true
POWERLEVEL9K_TIME_BACKGROUND=057
POWERLEVEL9K_TIME_FOREGROUND=black
POWERLEVEL9K_TIME_FORMAT='%D{%H:%M:%S}'
POWERLEVEL9K_TODO_BACKGROUND=green
POWERLEVEL9K_TODO_FOREGROUND=black
POWERLEVEL9K_USER_TEMPLATE=%n
POWERLEVEL9K_VCS_ACTIONFORMAT_FOREGROUND=red
POWERLEVEL9K_VCS_BACKENDS=( git )
POWERLEVEL9K_VCS_GIT_HOOKS=( vcs-detect-changes git-untracked git-aheadbehind git-stash git-remotebranch git-tagname )
POWERLEVEL9K_VCS_HG_HOOKS=( vcs-detect-changes )
POWERLEVEL9K_VCS_HIDE_TAGS=false
POWERLEVEL9K_VCS_INTERNAL_HASH_LENGTH=8
POWERLEVEL9K_VCS_LOADING_TEXT=loading
POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY=-1
POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS=0.0500000000
POWERLEVEL9K_VCS_SHOW_SUBMODULE_DIRTY=false
POWERLEVEL9K_VCS_SVN_HOOKS=( vcs-detect-changes svn-detect-changes )
POWERLEVEL9K_VI_COMMAND_MODE_STRING=NORMAL
POWERLEVEL9K_VI_INSERT_MODE_STRING=INSERT
POWERLEVEL9K_VPN_IP_INTERFACE=tun
POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS=' '
POWERLEVEL9K_WHITESPACE_BETWEEN_RIGHT_SEGMENTS=' '
zsh:1: warning: 1 jobs SIGHUPed
Killed by signal 1.
nullset2 commented 5 years ago

UPDATE: solved it by ensuring that Mac OS uses homebrew's zsh 5.7 instead of the default OS zsh:

sudo dscl . -create /Users/$USER UserShell /usr/local/bin/zsh

Thank you for this! Makes something that I already love even more love-worthy. Kudos!

mnekkach commented 5 years ago

Hi,

I have the same problem, but zsh version is zsh 5.7.1 (x86_64-apple-darwin16.7.0) and it is not a old version.

When I want to use @nullset2 command the problem is always present.

The command :

zsh -ic 'uname -a && zsh --version && set | grep -E "^POWERLEVEL9K"' 2>&1

return :

zsh -ic 'uname -a && zsh --version && set | grep -E "^POWERLEVEL9K"' 2>&1
Darwin mbpnekcorp.home 16.3.0 Darwin Kernel Version 16.3.0: Thu Nov 17 20:23:58 PST 2016 root:xnu-3789.31.2~1/RELEASE_X86_64 x86_64
zsh 5.7.1 (x86_64-apple-darwin16.7.0)
POWERLEVEL9K_ALWAYS_SHOW_CONTEXT=false
POWERLEVEL9K_ALWAYS_SHOW_USER=false
POWERLEVEL9K_ANACONDA_LEFT_DELIMITER='('
POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER=')'
POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE=true
POWERLEVEL9K_BACKGROUND_JOBS_VERBOSE_ALWAYS=false
POWERLEVEL9K_BATTERY_HIDE_ABOVE_THRESHOLD=999
POWERLEVEL9K_BATTERY_LEVEL_BACKGROUND=(  )
POWERLEVEL9K_BATTERY_LOW_THRESHOLD=10
POWERLEVEL9K_BATTERY_STAGES=''
POWERLEVEL9K_BATTERY_VERBOSE=true
POWERLEVEL9K_CHRUBY_SHOW_ENGINE=true
POWERLEVEL9K_CHRUBY_SHOW_VERSION=true
POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=2
POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=3
POWERLEVEL9K_CONTEXT_TEMPLATE=%n@%m
POWERLEVEL9K_DATE_FORMAT='%D{%d.%m.%y}'
POWERLEVEL9K_DIR_OMIT_FIRST_CHARACTER=false
POWERLEVEL9K_DIR_PACKAGE_FILES=( package.json composer.json )
POWERLEVEL9K_DIR_PATH_ABSOLUTE=false
POWERLEVEL9K_DIR_PATH_HIGHLIGHT_BOLD=false
POWERLEVEL9K_DIR_PATH_SEPARATOR=/
POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND=''
POWERLEVEL9K_DIR_SHOW_WRITABLE=false
POWERLEVEL9K_DISABLE_GITSTATUS=false
POWERLEVEL9K_DISABLE_RPROMPT=false
POWERLEVEL9K_DISK_USAGE_CRITICAL_LEVEL=95
POWERLEVEL9K_DISK_USAGE_ONLY_WARNING=false
POWERLEVEL9K_DISK_USAGE_WARNING_LEVEL=90
POWERLEVEL9K_EXPERIMENTAL_TIME_REALTIME=false
POWERLEVEL9K_HIDE_BRANCH_ICON=false
POWERLEVEL9K_HOME_FOLDER_ABBREVIATION='~'
POWERLEVEL9K_HOST_TEMPLATE=%m
POWERLEVEL9K_IGNORE_TERM_COLORS=false
POWERLEVEL9K_IGNORE_TERM_LANG=false
POWERLEVEL9K_IP_INTERFACE='^[^ ]+'
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=( context dir vcs )
POWERLEVEL9K_LOAD_WHICH=5
POWERLEVEL9K_MAX_CACHE_SIZE=10000
POWERLEVEL9K_MODE=nerdfont-complete
POWERLEVEL9K_PROMPT_ADD_NEWLINE=false
POWERLEVEL9K_PROMPT_ON_NEWLINE=false
POWERLEVEL9K_PUBLIC_IP_FILE=/tmp/p9k_public_ip
POWERLEVEL9K_PUBLIC_IP_HOST=http://ident.me
POWERLEVEL9K_PUBLIC_IP_METHODS=( dig curl wget )
POWERLEVEL9K_PUBLIC_IP_NONE=''
POWERLEVEL9K_PUBLIC_IP_TIMEOUT=300
POWERLEVEL9K_PUBLIC_IP_VPN_INTERFACE=''
POWERLEVEL9K_PYENV_PROMPT_ALWAYS_SHOW=false
POWERLEVEL9K_RBENV_PROMPT_ALWAYS_SHOW=false
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=( status root_indicator background_jobs history time )
POWERLEVEL9K_SHORTEN_DELIMITER=…
POWERLEVEL9K_SHORTEN_DIR_LENGTH=-1
POWERLEVEL9K_SHORTEN_FOLDER_MARKER=.shorten_folder_marker
POWERLEVEL9K_SHORTEN_STRATEGY=''
POWERLEVEL9K_SHOW_CHANGESET=false
POWERLEVEL9K_STATUS_CROSS=false
POWERLEVEL9K_STATUS_HIDE_SIGNAME=false
POWERLEVEL9K_STATUS_OK=true
POWERLEVEL9K_STATUS_OK_IN_NON_VERBOSE=false
POWERLEVEL9K_STATUS_SHOW_PIPESTATUS=true
POWERLEVEL9K_STATUS_VERBOSE=true
POWERLEVEL9K_TIME_FORMAT='%D{%H:%M:%S}'
POWERLEVEL9K_USER_TEMPLATE=%n
POWERLEVEL9K_VCS_ACTIONFORMAT_FOREGROUND=red
POWERLEVEL9K_VCS_BACKENDS=( git )
POWERLEVEL9K_VCS_GIT_HOOKS=( vcs-detect-changes git-untracked git-aheadbehind git-stash git-remotebranch git-tagname )
POWERLEVEL9K_VCS_HG_HOOKS=( vcs-detect-changes )
POWERLEVEL9K_VCS_HIDE_TAGS=false
POWERLEVEL9K_VCS_INTERNAL_HASH_LENGTH=8
POWERLEVEL9K_VCS_LOADING_TEXT=loading
POWERLEVEL9K_VCS_MAX_INDEX_SIZE_DIRTY=-1
POWERLEVEL9K_VCS_MAX_SYNC_LATENCY_SECONDS=0.0500000000
POWERLEVEL9K_VCS_SHOW_SUBMODULE_DIRTY=false
POWERLEVEL9K_VCS_SVN_HOOKS=( vcs-detect-changes svn-detect-changes )
POWERLEVEL9K_VI_COMMAND_MODE_STRING=NORMAL
POWERLEVEL9K_VI_INSERT_MODE_STRING=INSERT
POWERLEVEL9K_VPN_IP_INTERFACE=tun
POWERLEVEL9K_WHITESPACE_BETWEEN_LEFT_SEGMENTS=' '
POWERLEVEL9K_WHITESPACE_BETWEEN_RIGHT_SEGMENTS=' '

Any help would be appreciated, thank a lot.

romkatv commented 5 years ago

You are likely running some other version of zsh when sourcing powerlevel10k. I added extra diagnostics that should help you figure out what's going on. Please update powerlevel10k and try again.

ghost commented 4 years ago

@romkatv Hi, thank you for great OSS.

I face this error with 5.8.

You are using ZSH version 5.8. The minimum required version for Powerlevel10k is 5.1.
Type 'echo $ZSH_VERSION' to see your current zsh version.
The shell you are currently running is likely /usr/local/Cellar/zsh/5.8/bin/zsh.
Darwin O-12252-MAC 19.6.0 Darwin Kernel Version 19.6.0: Mon Aug 31 22:12:52 PDT 2020; root:xnu-6153.141.2~1/RELEASE_X86_64 x86_64
zsh 5.8 (x86_64-apple-darwin19.3.0)
POWERLEVEL9K_CONFIG_FILE=/Users/kohei.murakami/.p10k.zsh
romkatv commented 4 years ago

@ryuta69 Please post the output of the following command:

() {
  emulate -L zsh -o xtrace
  type autoload
  type is-at-least
  autoload -Uz is-at-least || return
  is-at-least 5.1
  echo $?
}
ghost commented 4 years ago

@romkatv yes, it's below.

+(anon):2> type autoload
autoload is a shell builtin
+(anon):3> type is-at-least
is-at-least is a shell function from /usr/local/Cellar/zsh/5.8/share/zsh/functions/is-at-least
+(anon):4> autoload -Uz is-at-least
+(anon):5> is-at-least 5.1
+is-at-least:23> emulate -L zsh
+is-at-least:25> local IFS=.- min_cnt=0 ver_cnt=0 part min_ver version order
+is-at-least:27> min_ver=( 5 1 )
+is-at-least:28> version=( 5 8 0 )
+is-at-least:30> ((  0 <= 2  ))
+is-at-least:31> [[ '' != <-> ]]
+is-at-least:32> ((  ++ver_cnt > 3  ))
+is-at-least:33> [[ 5 = *[0-9][^0-9]* ]]
+is-at-least:45> part=5
+is-at-least:31> [[ 5 != <-> ]]
+is-at-least:48> true
+is-at-least:49> ((  ++min_cnt > 2  ))
+is-at-least:50> [[ 5 = <-> ]]
+is-at-least:50> break
+is-at-least:53> ((  part > min_ver[min_cnt]  ))
+is-at-least:54> ((  part < min_ver[min_cnt]  ))
+is-at-least:55> part=''
+is-at-least:30> ((  1 <= 2  ))
+is-at-least:31> [[ '' != <-> ]]
+is-at-least:32> ((  ++ver_cnt > 3  ))
+is-at-least:33> [[ 8 = *[0-9][^0-9]* ]]
+is-at-least:45> part=8
+is-at-least:31> [[ 8 != <-> ]]
+is-at-least:48> true
+is-at-least:49> ((  ++min_cnt > 2  ))
+is-at-least:50> [[ 1 = <-> ]]
+is-at-least:50> break
+is-at-least:53> ((  part > min_ver[min_cnt]  ))
+is-at-least:53> return 0
+(anon):6> echo 0
0
romkatv commented 4 years ago

Please run the following command and attach /tmp/p10k.log to this issue.

/usr/local/Cellar/zsh/5.8/bin/zsh -xis <<<'exit' &>/tmp/p10k.log
ghost commented 4 years ago

Here is this.

[p10k.log]()

ghost commented 4 years ago

@romkatv Oh, excuse me. This might be wrong.

I did brew install zsh, then it installs two zsh.

lrwxr-xr-x    25 kohei.murakami 2020-10-31 13:44 zsh -> ../Cellar/zsh/5.8/bin/zsh
lrwxr-xr-x    29 kohei.murakami 2020-10-31 13:44 zsh-5.8 -> ../Cellar/zsh/5.8/bin/zsh-5.8

If I use zsh-5.8, it worked. I don't know why, I have never experienced wrong by using /usr/local/bin/zsh, but anyway it worked.

I'm gonna check brew side.

romkatv commented 4 years ago

Here is this.

~p10k.log~

This log indicates that everything is fine. Powerlevel10k loads successfully without errors. Can you confirm that starting /usr/local/Cellar/zsh/5.8/bin/zsh works fine too?

ghost commented 4 years ago

@romkatv

Thank you for checking, and now, /usr/local/Cellar/zsh/5.8/bin/zsh also works.....

I really can't reproduce this error, but I describe how I encountered the error below.

  1. I started new Mac with factory-reset-OS.
  2. I did brew install zsh and sudo chsh -s /usr/local/bin/zsh.
  3. I typed zsh here, and I think I encountered the error here.

Maybe at 2nd step, zsh doesn't work right because I didn't logout...? Anyway thank you for checking.

bwendell commented 2 years ago

For anyone seeing this error in the future:

You are using ZSH version 5.8. The minimum required version for Powerlevel10k is 5.1.
Type 'echo $ZSH_VERSION' to see your current zsh version.
The shell you are currently running is likely <path>.

Rather than starting a new session by typing zsh, I had to completely exit my terminal session and then it worked.

romkatv commented 2 years ago

This kind of error is caused by a misconfiguration of FPATH. The usual reason is when you wipe out FPATH completely. If this is done, autoloadable functions that ship with zsh won't be found. This includes is-at-least -- an autoloadable function that powerlevel10k uses to figure out which version of zsh it's being interpreted with.

I just pushed a commit that will survive broken FPATH. Your shell will still be broken of course and you might get a ton of errors from random places. At least those errors will not come from powerlevel10k.