ZSH: Disable 'cd' supporting usernames
Posted Fri, 02 May 2008
I have a directory called "lib". If I try to do "cd l<tab>", zsh will offer me "libuuid list lib" as completion candidates. The words 'libuuid' and 'list' show up because they are usernames. This is really annoying, and there doesn't seem to be an option to disable this. What happend to doing "cd ~root" to change to root's homedir? Was typing '~' too hard?
At any rate, I figured out where to fix the unfeature: A file '_tilde' in path/to//zsh/4.3.4/functions/Completion/Zsh. It happens to be /usr/share/zsh/4.3.4/functions/Completion/Zsh on my ubuntu workstation.
... around line 22 ... while _tags; do _requested users && _users "$suf[@]" "[email protected]" && ret=0 _requested named-directories expl 'named directory' \ ...Comment out the bold line above (starting '_requested users ...') and restart zsh. This only disabled the username completion part of zsh's cd command, but that's good enough for now. If I ever accidentally typo and cd to someone's home directory, I can just popd to return to my previous location.