Search this site

Metadata

Articles

Projects

Presentations

ZSH: Disable 'cd' supporting usernames

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[@]" "$@" && 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.

2 responses to 'ZSH: Disable 'cd' supporting usernames'

Showing last 2 comments... (Click here to view all comments)

Mark Tran wrote at Fri May 2 16:30:36 2008...
This is probably related to the CDABLE_VARS option. I had the same problem on scorn when your configuration file was being used as the global zshrc. "setopt NO_CDABLE_VARS" seemed to do the trick.

Richard Kolkovich wrote at Mon May 5 10:35:30 2008...
I don't have this 'feature' enabled in my zsh, and I don't have NO_CDABLE_VARS set explicitly.  zshrc at http://sarumont.sigil.org/files/zshrc for comparison. :)


Leave a reply

You need javascript enabled to use this form. Anti-spam efforts ongoing. Also, if the comment doesn't show up, it's because the form expired. Go back and copy your comment, reload the form, and resubmit. Apologies if this is a hassle, I'm just playing with antispam methods right now. If this insists on not working, please email me about it.

Name (required)
E-mail (optional, if you want me to be able to email you back)
URL (also optional)
Comment: