diff options
author | Dominik Ritter <dritter03@googlemail.com> | 2015-11-21 23:04:58 +0300 |
---|---|---|
committer | Dominik Ritter <dritter03@googlemail.com> | 2015-11-21 23:04:58 +0300 |
commit | 0aaf99985754cc0759ca3b7e94bdee111d5a94f8 (patch) | |
tree | 3f8a89448d9dd4c4afbbaebe512b58ec58d01a5a /powerlevel9k.zsh-theme | |
parent | 1eadf5ad76d0d9a9a5c4f6e6b2cde47c018363c0 (diff) |
For ZSH 5.0.8 `whence -v` tells also the path to the command. In that case we can use that information to get a proper path to the utility functions.
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-x | powerlevel9k.zsh-theme | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 002267f4..727461d1 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -19,9 +19,15 @@ # Check if the theme was called as a function. if [[ $(whence -w prompt_powerlevel9k_setup) =~ "function" ]]; then - # Script is a function! We assume this to happen only in - # prezto, as they use the zstyle-builtin to set the theme. - 0="${ZDOTDIR:-$HOME}/.zprezto/modules/prompt/functions/prompt_powerlevel9k_setup" + autoload -U is-at-least + if is-at-least 5.0.8; then + # Try to find the correct path of the script. + 0=$(whence -v $0 | sed "s/$0 is a shell function from //") + else + # Script is a function! We assume this to happen only in + # prezto, as they use the zstyle-builtin to set the theme. + 0="${ZDOTDIR:-$HOME}/.zprezto/modules/prompt/functions/prompt_powerlevel9k_setup" + fi fi # Check if filename is a symlink. |