I have configured some directories alias via hash -d hashname=/path/to/directory command. Completion for that aliases works for a long time like this:

% hashn<TAB> # becomes hashname, pressing <ENTER> works like cd /path/to/directory

Some times ago this has stopped to work. Now that aliases are completable only if starts with ~ sign:

% ~hashn<TAB> # only this works

Is there any way to get previous behaviour?

  • Running hashname after hash -d hashname=… wouldn't treat hashname as a named directory, not even under setopt autocd. Are you sure you hadn't made hashname an alias? If you do run hashname now, what does it do? What is the output of type hashname? – Gilles May 19 '16 at 21:13
  • for now type hashname returns hashname not found. I am definetely sure that I hadn't made alias for hashname – Artur Eshenbrener May 20 '16 at 8:02

You had the options auto_cd and cdable_vars turned on. With auto_cd, if you type a directory as a command name, the cd command is implied. With cdable_vars, if a directory doesn't exist, or a command doesn't exist with auto_cd, then the name is looked up in the directory hash table.

As long as you're using the “new-style” (compinit) completion system, which oh-my-zsh turns on, the name will be offered as a completion when relevant.

  • Adding setopt autocd cdable_vars does the job, thank you! – Artur Eshenbrener May 20 '16 at 8:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.