Shell – in zsh, how to hide the backslashes in the completion menu

linuxosxshellzsh

On Mac OS X 10.6, zsh. I have set in .zshrc:

setopt automenu

…to get a completion menu below the prompt. When I type:

cd <TAB>

I see a completion menu with all directories that have spaces in their names having those spaces escaped with a backslash. I would like them to be displayed without the escaping backslash for better readability. This works in bash and in tcsh and when I do run ls from zsh. I don't see the ugly slashes.

The actual line on the prompt of course needs those escaped spaces for the command to work, but the list of directories below shouldn't show them escaped.

Can anyone demonstrate how to achieve this? I have not found a setting to change the output in the completion menu

Best Answer

I looked around, but there's not much on customizing the cd command. If you really want to go messing around with the completion check out:

/usr/share/zsh/functions/Completion/Zsh/_cd

However an easier solution would be to just type a " after cd then press Tab:

cd "<Tab>
Related Question