summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Rogers <webdev@centralblue.co.uk>2020-11-05 10:40:45 +0000
committerMarc Cornellà <hello@mcornella.com>2021-09-22 11:30:07 +0200
commit16de51404773a5e849c25a95e7612e212e7256a7 (patch)
tree7a8fe02c0ef103a3213d1aec88f635620c2fee53
parent3e4b520190f1e4aaced9267bd5dcde59b3d0211f (diff)
downloadzsh-16de51404773a5e849c25a95e7612e212e7256a7.tar.gz
zsh-16de51404773a5e849c25a95e7612e212e7256a7.tar.bz2
zsh-16de51404773a5e849c25a95e7612e212e7256a7.zip
feat(lib): allow setting custom completion dots sequence (#9424)
Closes #9424 Closes #9703 Co-authored-by: mortezadadgar <mortezadadgar97@gmail.com> Co-authored-by: Marc Cornellà <hello@mcornella.com>
-rw-r--r--lib/completion.zsh7
-rw-r--r--templates/zshrc.zsh-template5
2 files changed, 8 insertions, 4 deletions
diff --git a/lib/completion.zsh b/lib/completion.zsh
index ebaab0856..2c5695487 100644
--- a/lib/completion.zsh
+++ b/lib/completion.zsh
@@ -58,9 +58,12 @@ zstyle ':completion:*:*:*:users' ignored-patterns \
# ... unless we really want to.
zstyle '*' single-ignored show
-if [[ $COMPLETION_WAITING_DOTS = true ]]; then
+if [[ ${COMPLETION_WAITING_DOTS:-false} != false ]]; then
expand-or-complete-with-dots() {
- print -Pn "%F{red}…%f"
+ # use $COMPLETION_WAITING_DOTS either as toggle or as the sequence to show
+ [[ $COMPLETION_WAITING_DOTS = true ]] && COMPLETION_WAITING_DOTS="%F{red}…%f"
+ # turn off line wrapping and print prompt-expanded "dot" sequence
+ printf '\e[?7l%s\e[?7h' "${(%)COMPLETION_WAITING_DOTS}"
zle expand-or-complete
zle redisplay
}
diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template
index 65d5ea65b..4a998c2fc 100644
--- a/templates/zshrc.zsh-template
+++ b/templates/zshrc.zsh-template
@@ -45,8 +45,9 @@ ZSH_THEME="robbyrussell"
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
-# Caution: this setting can cause issues with multiline prompts (zsh 5.7.1 and newer seem to work)
-# See https://github.com/ohmyzsh/ohmyzsh/issues/5765
+# You can also set it to another string to have that shown instead of the default red dots.
+# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f"
+# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765)
# COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files