This was a change in zsh 5.4.1 where prompt_sp is now reset on calls to
prompt, unlike previous behavior where it was set by default. This
restores the previous default behavior.
Refs #1423, but is not a complete fix because we need to wait for
external prompts to update as well.
This includes some improvements by @indrajitr in addition to the main migration.
The first step was to avoid PROMPT and RPROMPT modification when possible (which may help resolve some other issues as well relating to zsh crashes with the sorin prompt) then update the displayed git information in a separate variable rather than a command.
We use zsh-async for creating and running background tasks. The sorin prompt uses it to update git info without blocking the prompt from displaying (because of how long it can take). In the future it may be worth moving more tasks and more prompts to using this.
The move to zsh-async does make the git prompt slower in some circumstances (most noticeable in large repos), but this is a worthwhile tradeoff to avoid the cache file which had a number of potential security holes.
We have also switched to adding zsh-async as an external submodule (rather than the version bundled with pure) which may cause some migration headaches, but it will be worth it in the long run.
Changes:
* In prezto, function names are hyphenated ('-') by convention,
rename `promptpwd` to `prompt-pwd` accordingly.
* Unset local variable `current_pwd` proactively.
* Tweak additional documentation for `prompt-pwd`.
Escape all $ except the first $. Escape all backtick `'s. This prevents
variable names or shell expansions placed as branch names from
remotely exploiting code.
Fixes issue #1267 for sorin prompt.
The terms 'prompt' and 'rprompt' are not always appropriate.
A multi-line theme may choose 'line-one' and 'line-two' instead.
@ColinHebert contributed to this commit.