site logo

Fix Annoying Cursor Glitches of Zsh Autosuggestions

Installing new Arch Linux machines are always delightful. Customization, lightweight, and maximum performance.

However, in my career of installing 5 Arch Linux servers, there is this one server that always seems fishy. When zsh-autosuggestions tries to suggest past commands, the terminal’s cursor always gets messed up and starts to glitch everywhere. Deleting current characters would result in random characters disappearing, and random typing errors would appear when you press enter. This has never appeared on my other machines.

Since all my servers are manually installed, this can only be a misstep in the installation procedure, maybe a missing step.

Fortunately, it is caused by one recurring missing step: locale.

Generating and configuring locales

In Arch Linux wiki, generating and configuring locales are merged in the same section. And the “configuration” section is minimal. However, missing this step causes all kinds of terminal issues, including this one.

So I just need to generate and configure locales correctly to fix this.

Checking locales

Type locale command, and if your locales are unconfigured, it should output "C".

Configuring locales

Create or edit /etc/locale.conf with the following content:

LANG=en_US.UTF-8

Now your system locale has been set to en_US.UTF-8. And all your annoying Zsh glitches are gone!