17

In bash, I can use tab-completion to move one directory up and descend down again another path. For example, suppose I'm in $HOME/folder1, and I want to cd to $HOME/folder2. $HOME only has the two child directories folder1 and folder2.

In bash, I could just type

cd ..[TAB]f[TAB]2

and would end up in $HOME/folder2. In my fresh zsh installation, pressing cd ..[TAB] produces a list of those child directories of $HOME/folder1 which have two . in their name.

Is there a simple way to get the behaviour I'm used to? Or is there something even easier to achieve what I want in zsh?

  • Yeah, (re)learn to hit / (slash) instead of TAB for a directory delimiter. You've already typed .. the / is right next to . on every keyboard I've seen. – Ricky Beam Feb 7 '14 at 18:23
  • 2
    Down voting a new user with an honest question isn't cool. No reason for that! I see that he tried explaining the best he could. – Jeight Feb 7 '14 at 19:18
  • 7
    @RickyBeam You should take a look at non-english keyboards then ;) I'm using a German keyboard, and there the / is very inconveniently located at SHIFT+7. – andreas-h Feb 7 '14 at 19:32
  • I have a UK and Korean(?) keyboard, and they both use a standard QWERTY layout. DEC and SUN keyboards can be a little weird, but I don't have them at hand. I'd reprogram my keyboard if I had to hit shift-7 to get a slash. – Ricky Beam Feb 7 '14 at 19:53
21

Add this to your .zshrc and ..[TAB] will complete to ../ as per bash.

zstyle ':completion:*' special-dirs true

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.