diff options
author | romkatv <roman.perepelitsa@gmail.com> | 2019-10-27 12:30:39 +0300 |
---|---|---|
committer | romkatv <roman.perepelitsa@gmail.com> | 2019-10-27 12:30:39 +0300 |
commit | d40f54f30de765b764d916f0128e524940b3ad9c (patch) | |
tree | 6e52b208f50972fbfd5bd0c604e9cf0cd51db53f /config/p10k-lean.zsh | |
parent | e7520409d117e454d9a688c8e403d5fedf55993c (diff) |
define instant_prompt_example to demonstrate how to add segments to instant prompt
Diffstat (limited to 'config/p10k-lean.zsh')
-rw-r--r-- | config/p10k-lean.zsh | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/config/p10k-lean.zsh b/config/p10k-lean.zsh index 9e450186..43479409 100644 --- a/config/p10k-lean.zsh +++ b/config/p10k-lean.zsh @@ -789,9 +789,28 @@ p10k segment -f 208 -i '⭐' -t 'hello, %n' } + # User-defined prompt segments may optionally provide an instant_prompt_* function. Its job + # is to generate the prompt segment for display in instant prompt. See + # https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt. + # + # Powerlevel10k will call instant_prompt_* at the same time as the regular prompt_* function + # and will record all `p10k segment` calls it makes. When displaying instant prompt, Powerlevel10k + # will replay these calls without actually calling instant_prompt_*. It is imperative that + # instant_prompt_* always makes the same `p10k segment` calls regardless of environment. If this + # rule is not observed, the content of instant prompt will be incorrect. + # + # Usually, you should either not define instant_prompt_* or simply call prompt_* from it. If + # instant_prompt_* is not defined for a segment, the segment won't be shown in instant prompt. + function instant_prompt_example() { + # Since prompt_example always makes the same `p10k segment` calls, we can call it from + # instant_prompt_example. This will give us the same `example` prompt segment in the instant + # and regular prompts. + prompt_example + } + # User-defined prompt segments can be customized the same way as built-in segments. - typeset -g POWERLEVEL9K_EXAMPLE_FOREGROUND=208 - typeset -g POWERLEVEL9K_EXAMPLE_VISUAL_IDENTIFIER_EXPANSION='${P9K_VISUAL_IDENTIFIER}' + # typeset -g POWERLEVEL9K_EXAMPLE_FOREGROUND=208 + # typeset -g POWERLEVEL9K_EXAMPLE_VISUAL_IDENTIFIER_EXPANSION='⭐' # Instant prompt mode. # |