diff options
| author | Carlo Sala <carlosalag@protonmail.com> | 2024-10-08 20:26:23 +0200 |
|---|---|---|
| committer | Carlo Sala <carlosalag@protonmail.com> | 2024-10-08 20:41:58 +0200 |
| commit | 2a109d30afe4ab164a946c307abc3d2a444a42ad (patch) | |
| tree | 74a02a443c1e3e2fe0e8037467f21883543926b8 /lib | |
| parent | 0a6f88ba0672f38d6925f8ffc8e7658e99f37489 (diff) | |
| download | zsh-2a109d30afe4ab164a946c307abc3d2a444a42ad.tar.gz zsh-2a109d30afe4ab164a946c307abc3d2a444a42ad.tar.bz2 zsh-2a109d30afe4ab164a946c307abc3d2a444a42ad.zip | |
feat(git): add escape hatch to enable async prompt
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/git.zsh | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/git.zsh b/lib/git.zsh index 0efff3e07..a1b4d1587 100644 --- a/lib/git.zsh +++ b/lib/git.zsh @@ -44,6 +44,7 @@ function _omz_git_prompt_info() { # - https://github.com/ohmyzsh/ohmyzsh/issues/12331 # - https://github.com/ohmyzsh/ohmyzsh/issues/12360 # TODO(2024-06-12): @mcornella remove workaround when CentOS 7 reaches EOL +local _style if zstyle -t ':omz:alpha:lib:git' async-prompt \ || { is-at-least 5.0.6 && zstyle -T ':omz:alpha:lib:git' async-prompt }; then function git_prompt_info() { @@ -81,6 +82,21 @@ if zstyle -t ':omz:alpha:lib:git' async-prompt \ # Register the async handler first. This needs to be done before # the async request prompt is run precmd_functions=(_defer_async_git_register $precmd_functions) +elif zstyle -s ':omz:alpha:lib:git' async-prompt _style && [[ $_style == "force" ]]; then + function git_prompt_info() { + if [[ -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_info]}" ]]; then + echo -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_info]}" + fi + } + + function git_prompt_status() { + if [[ -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_status]}" ]]; then + echo -n "${_OMZ_ASYNC_OUTPUT[_omz_git_prompt_status]}" + fi + } + + _omz_register_handler _omz_git_prompt_info + _omz_register_handler _omz_git_prompt_status else function git_prompt_info() { _omz_git_prompt_info |
