tags:

views:

552

answers:

3
+2  A: 

This document should give you a good explanation:

In short, few terminals support a shifted Tab, but you might be able to get your terminal to support a "backtab" key sequence which you can configure X to send.

a paid nerd
+1  A: 

I'm not sure exactly what you require by a backward-tab, but zsh does have an undo zle widget which undoes the effect of the last pressed keystroke, be it Tab or anything else. Use it by binding it to a key:

$> bindkey "<Ctrl-V><Shift-Tab>" undo

The means you press those key combos, don't type out the letters.

I think this is what you're asking for, but I can't tell for sure without more examples.

sykora
I added a picture to my Question. I shows what I am trying to achieve. I backTAB, for instance, for the command cd.
Masi
Then this should work.
sykora
@sykora: It does not. It ignores the TAB completion, and undo the "d" in the command cd.
Masi
I've edited the answer to make things a bit clearer.
sykora
@sykora: I get the following code: bindkey ^[[Z undo. I put it to terminal and it gives me zsh: bad pattern: ^[[Z.
Masi
Gah, forgot the quotes. Now try it.
sykora
@sykora: Do you use Ctrl-V always when you try to make these keybindings. It seems to be like xev which shows what you type, but it is builtin feature in Shell.
Masi
Use the bindkey command. Ctrl-V is bound to quoted insert. That means that anything typed after Ctrl-V is inserted as-is, and no effect is carried out. This way you can insert control-sequences literally.
sykora
+6  A: 

Try this:

bindkey '^[[Z' reverse-menu-complete

If this doesn't work, try running executing zsh like this:

zsh -Y

and then try again!

ypsu
This is awesome.
a paid nerd
@ypsu: Thank you for your answer! Your solution is exactly what I was looking for.
Masi
@ypsu: +1 Thanks from another user, this is wonderful!
gatoatigrado