19

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?

Rui F Ribeiro
  • 55,929
  • 26
  • 146
  • 227
andreas-h
  • 649
  • 1
  • 8
  • 12
  • 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 Feb 07 '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 07 '14 at 19:18
  • 9
    @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 07 '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 Feb 07 '14 at 19:53

1 Answers1

24

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

zstyle ':completion:*' special-dirs true
bsd
  • 10,916
  • 4
  • 30
  • 38