When I use tab-completion in zsh, the shell suggests me files and I discover that I'm in the wrong directory. How can I just delete the suggestion instead of backspace'ing it?


You can use the undo command (C-_ or C-x u) to cancel the effect of the last completion.

You can then press C-q or M-q to “suspend” the current command, enter cd correct-directory and resume your editing of that suspended command.

  • Thanks Gilles. Hmm they all do not work, but I guess that is because I'm using iTerm on Mac, and the key combinations are actually triggering iTerm. For example, M-q quits iTerm :-/ – Daniel Nov 18 '11 at 22:24

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.