mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-12-18 05:40:07 +00:00
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.
This commit is contained in:
parent
29693f957d
commit
538d8b8fa8
1 changed files with 14 additions and 2 deletions
|
@ -17,11 +17,23 @@
|
||||||
#zstyle ':vcs_info:*+*:*' debug true
|
#zstyle ':vcs_info:*+*:*' debug true
|
||||||
#set -o xtrace
|
#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.
|
# 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)"
|
filename="$(realpath -P $0 2>/dev/null || readlink -f $0 2>/dev/null)"
|
||||||
else
|
elif [[ -f $0 ]]; then
|
||||||
|
# Script is a file
|
||||||
filename="$0"
|
filename="$0"
|
||||||
|
else
|
||||||
|
print -P "%F{red}Script location could not be found!%f"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
script_location="$(dirname $filename)"
|
script_location="$(dirname $filename)"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue