0

In cd -1, -2, -3 etc in Z shell it appears you can do cd -<tab> and cd +<tab> to do tab-completion of the directory stack. I think it's supposed to work out of the box on zsh?

However this doesn't work for me. I've even tried the suggestions in https://unix.stackexchange.com/a/157773 and that doesn't work either.

I'm using zsh 5.2 (x86_64-unknown-linux-gnu) on archlinux.

The output of setopt is

alwaystoend
autocd
autopushd
cdablevars
extendedhistory
histignorealldups
nohup
interactive
interactivecomments
monitor
nonomatch
promptsubst
pushdminus
shinstdin
zle

How can I make tab completion of the directory stack work?

Community
  • 1
  • 1
user779159
  • 9,034
  • 14
  • 59
  • 89
  • This may be a stupid question, but did you remember to initialise the zsh completion subsystem with `autoload -U compinit && compinit`? – wjv Apr 07 '16 at 16:05

1 Answers1

0

So, I didn't realize this was a feature but when I tried it in a new tab, it didn't work for me either. But then, after I cd'd around a bit, the tab completion worked as expected. Maybe that's your only issue?

Also, as an alternative method, if you're not using the z plugin, you should check it out. It keeps a global history of all the directories you cd into so that in the future you only have to type a small part of the directory name to get back to it.

Scott Schupbach
  • 1,284
  • 9
  • 21