Filling zsh tab messes up command line formatting

I run zsh with oh-my-zsh on OS X. Every time I use zsh awesome tab-completion, the formatting at the current command prompt is really screwed up. For instance:

I type cd fo and try filling out a tab for the "foo" directory; zsh requests completion, but changes the command line to cd fo cd fo while it waits for completion. It doesnโ€™t matter, but itโ€™s very annoying. Any suggestions?

+6
source share
2 answers

I encountered the same problem before, my solution disables some zsh plugins. The second possibility is that your color theme may contain an error that causes this.

 # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ # Example format: plugins=(rails git textmate ruby lighthouse) plugins=(git) 

This is the final version of my plugin section in the ~ / .zshrc file. Any other plugin between brackets may be the cause of your situation.

If your problem is still ongoing, you need to send a ~/.zshrc message so that we can check what is there.

+1
source

I had the same issue on PopOS and Arch Linux. I tried several solutions from different places, but the only solution that helped me was the proposal from romkatv on the oh-my-zsh github repository.

The solution is to make a copy of the .zsh-theme file of any theme that you use in oh-my-zsh and surround all non-ASCII characters (e.g. emoticons) with %{%G<CHARACTER>%}

For example, the standard oh-my-zsh robbyrussel contains 2 non-ASCII characters. The โžœ symbol in the invitation

 PROMPT="%(?:%{$fg_bold[green]%}โžœ :%{$fg_bold[red]%}โžœ )" 

and the symbol 'โœ—' in the git directories prompt

 ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}โœ—" 

Using %{%G<character>%} around two non-ASCII characters like this

 PROMPT="%(?:%{$fg_bold[green]%}โžœ :%{$fg_bold[red]%}%{%Gโžœ%} )" 

and this

 ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}%{%Gโœ—%}" 

solved the problem for me.

0
source

Source: https://habr.com/ru/post/950568/


All Articles