Tab autocompletion of accented characters with oh-the-zsh doesn’t work

autocompleteoh-my-zshzsh

I am not able to properly display autocompleted filenames that contain accented characters like ã in my shell configuration of zsh and oh-my-zsh.

I've created a filename cão.txt to demonstrate this issue. If you're interested, that means dog in Portuguese.

So, when I try to autocomplete like cat c<tab>, this happens:

% cat ca<0303>o.txt
hi dog

and echo $0 gives me: -zsh

But, if I go to a "plain" zsh session the exact same autocomplete works ok:

% zsh
% echo $0
zsh
%  cat cão.txt
hi dog

My locale is like this:

LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL="en_US.UTF-8"

and the LANG variable I tried it empty, with "en_US.UTF-8" and also "pt_PT.UTF-8". Also, I double-checked the locale settings are exactly the same before and after going to the "plain" zsh session.

Also it works the same way in both the default terminal OSX application and iTerm2.

I'm using zsh version 5.0.7.

Here is my .zshrc file, as well as other dotfiles I'm using.

I've tried uninstalling oh-my-zsh and install it in either the automatic and manual way, always with the same problem of displaying accented characters with autocomplete.

Best Answer

This looks like normal default zsh behavior. Whether combining characters are displayed combined during autocompletion is controlled by the combining_chars shell option. To have it complete to cão, put this in your ~/.zshrc file.

setopt combining_chars

I can't reproduce your behavior where this is the default for non-login (zsh vs -zsh) shells.

In the case of zsh -f and the non-login zsh, they are sourcing only /etc/zshenv, and not the other configuration files. Maybe you have your /etc/zshenv configured to setopt combining_chars and something later in the initialization sequence is resetting it.

Related Question