Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

(See my previous question for additional context).

I'm migrating to zsh from bash, and using oh-my-zsh. When my zsh history looks something like the following:

git status
git add -A
git commit

I want to be able to re-run git add -A. To do that, I could use !?git add, which should:

!?str[?] Refer to the most recent command containing str. The trailing ‘?’ is necessary if this reference is to be followed by a modifier or followed by any text that is not to be considered part of str.

The link for zsh event designators is here.

Unfortunately, I can't do this - as I'm typing !?git add, as I hit the ' ', it auto-completes the command to the most recent command matching git (ie, it auto-completes with git commit). I can't use the event designator properly because of this auto-completion as I hit the space.

I assume this is an oh-my-zsh feature. I have no idea where to look, though - greping for 'complet' in the oh-my-zsh source doesn't get me anywhere.

My question: how do I turn off this feature? Or, if that's not something that's known, where should I be looking - if I was going to implement this auto-complete when whitespace is entered, where would be a logical place to do so in the oh-my-zsh framework?

share|improve this question
up vote 1 down vote accepted

Look in oh-my-zsh/lib/key-bindings.zsh and you'll see the line

bindkey ' ' magic-space    # also do history expansion on space

comment it out to remove this feature.

share|improve this answer
Thanks! Very much indeed. – simont Apr 6 '12 at 20:06

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.