diff options
author | Dominik Ritter <dritter03@googlemail.com> | 2015-05-27 22:03:02 +0300 |
---|---|---|
committer | Dominik Ritter <dritter03@googlemail.com> | 2015-05-27 23:40:13 +0300 |
commit | d01d718bd6da4446d528262192e78fcfa6a9ebed (patch) | |
tree | 11e03d6a8a9829333af1dc10dc9357313fd60d25 | |
parent | f7af54cdf23e8fff0dedaa6dca26bcce73cbea98 (diff) |
Modified code to work with prezto.
-rw-r--r-- | powerlevel9k.zsh-theme | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index d1e927c8..b7157f75 100644 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -423,17 +423,29 @@ build_right_prompt() { done } -precmd() { +prompt_powerlevel9k_precmd() { vcs_info # Add a static hook to examine staged/unstaged changes. vcs_info_hookadd set-message vcs-detect-changes } -if [[ "$POWERLEVEL9K_PROMPT_ON_NEWLINE" == true ]]; then - PROMPT='╭─%{%f%b%k%}$(build_left_prompt) -╰─ ' -else - PROMPT='%{%f%b%k%}$(build_left_prompt) ' -fi -RPROMPT='%{%f%b%k%}$(build_right_prompt)%{$reset_color%}' +powerlevel9k_init() { + setopt LOCAL_OPTIONS + unsetopt XTRACE KSH_ARRAYS + prompt_opts=(cr percent subst) + + autoload -Uz add-zsh-hook + + add-zsh-hook precmd prompt_powerlevel9k_precmd + + if [[ "$POWERLEVEL9K_PROMPT_ON_NEWLINE" == true ]]; then + PROMPT="╭─%{%f%b%k%}"'$(build_left_prompt)'" +╰─ " + else + PROMPT="%{%f%b%k%}"'$(build_left_prompt)'" " + fi + RPROMPT="%{%f%b%k%}"'$(build_right_prompt)'"%{$reset_color%}" +} + +powerlevel9k_init "$@" |