diff options
author | Dominik Ritter <dritter03@googlemail.com> | 2015-11-07 18:32:48 +0300 |
---|---|---|
committer | Dominik Ritter <dritter03@googlemail.com> | 2015-11-07 18:32:48 +0300 |
commit | 538d8b8fa8b4fbfe4fdcab6e57867d1e6b434c5a (patch) | |
tree | 3f88b35763ec8b6780f39e884a609072bac4718a /powerlevel9k.zsh-theme | |
parent | 29693f957d237df0109acf66544a93e6f4ee4c33 (diff) |
Bugfix for prezto: In prezto the theme gets called by function (via zstyle). In that case we hardcode the path to the theme as there seems no way to find the location so that we can source our other functions.
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-x | powerlevel9k.zsh-theme | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 32a03b94..b35dafda 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -17,11 +17,23 @@ #zstyle ':vcs_info:*+*:*' debug true #set -o xtrace +# 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" +fi + # Check if filename is a symlink. -if [[ -L "$0" ]]; then +if [[ -L $0 ]]; then + # Script is a symlink filename="$(realpath -P $0 2>/dev/null || readlink -f $0 2>/dev/null)" -else +elif [[ -f $0 ]]; then + # Script is a file filename="$0" +else + print -P "%F{red}Script location could not be found!%f" + exit 1 fi script_location="$(dirname $filename)" |