zsh tab completion bug on ubuntu
-
16-06-2021 - |
Pergunta
I'm getting a really annoying bug here:
% git s<TAB>
becomes
% git sgit s
send-email -- send collection of patches as emails
send-pack -- push objects over git protocol to another repository
...
It just duplicates the command. If I resize the screen, it goes back to normal: git s
How do I fix this?
Solução
I got it! Darn. It's my prompt
instead of:
PS1=$'%B%F{$fg[green]%}${PWD/#$HOME/~}%{$reset_color%}`git-prompt` ${VIMODE} '
I should just do
PS1=$'%{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}`git-prompt` ${VIMODE} '
And everything works fine now...
Outras dicas
I had this problem on macOS, and would like to share how I fixed it.
As far as I can tell, this happens when there is some problem with your custom prompt. I had:
PROMPT='%{$fg[green]%}%n@%m%{$reset_color%}:%{$fg[cyan]%}${(%):-%~}$reset_color%}$ '
And after close inspection, I noticed that the last colour change ($reset_color
) was incorrectly wrapped. I then changed the prompt like so:
PROMPT='%{$fg[green]%}%n@%m%{$reset_color%}:%{$fg[cyan]%}${(%):-%~}%{$reset_color%}$ '
And I no longer had the issue.