zsh-autosuggestions: zsh-autosuggestions misbehaving

Describe the bug

The zsh-autosuggestions is misbehaving. Every-time I start writing a command starting with letter a , the shell suggestion adds some gap between the third and second letter. For example:

  • when if try to write awk -v it outputs me this : image
  • When trying to start ark from CLI, the output is : image

To Reproduce

Steps to reproduce the behavior:

  • Was trying to execute date -u +%V$(uname)|sha1sum|sed 's/\W//g' but unfortunately executed : image

Notice the missing ' and additional \n\n

  • After this the problem started

Expected behavior

I shouldn’t be getting the output shown. I am not able to do stuff this way

Desktop

  • OS + distribution: Arch Linux (plasma 5.20.1)
  • Zsh version: 5.8
  • Kernel: Linux 5.4.72-1-lts

Additional context

I tried out the commands on Konsole and Guake, Both are misbehaving. But somehow TTYs are good

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 8
  • Comments: 21 (1 by maintainers)

Most upvoted comments

It was caused by my PROMPT. I changed $fg[cyan] to %{$fg[cyan]%} and the issue stopped.

Can confirm, on starship prompt fixed it with

[character]
success_symbol = '%{%G[➜](bold green)%}'
error_symbol = '[➜](bold red)'

Thanks for the post above!

Did you manage to fix this? I have the same problem in mac. In iTerm in JetBrains editor terminal its misbihaving image

It was caused by my PROMPT. I changed $fg[cyan] to %{$fg[cyan]%} and the issue stopped.

I have to sign in to comment, bro you are the true hero 👍

Just my 2 cents for iTerm users This happened to me with starship prompt and drove me nuts pretty quickly.

I used the following configuration and noticed the issue didn’t occur when I removed the emoji / used my own prompt

# starship.toml
[time]
disabled = false
format = '🕙 [$time]($style) '

Coercing single character width with %G seemed to fix the issue

[time]
disabled = false
format = '%{%G🕙%}  [$time]($style) '

If you see the same symptoms due to character widths ( after making sure LC_ALL and LANG are utf-8), be sure to switch on the following in iTerm profile settings image

@AckslD thanks mate. Looks like it was my right side prompt setup. Once I adjusted that, the issue resolved

@sheanhoxie I solved this with the help of @ericfreese, see #578. Not sure it also solves the original issue by @deprov447 but worth a try.