Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

If I run the following commands in bash:

mkdir foo
cd !$

The second command will be interpreted as cd foo and executed.

In zshell (at least with my current configuration), it will make the substitution, create the command cd foo, and leave my cursor at the end of it, so that I have to hit enter again to execute.

Is there a way to make it just execute the command?

share|improve this question

1 Answer 1

From man zshoptions:

HIST_VERIFY

Whenever the user enters a line with history expansion, don't execute the line directly; instead, perform history expansion and reload the line into the editing buffer.

So just add setopt no_hist_verifyto your .zshrc

Edit: Remove accidental single quote that was breaking command

share|improve this answer
    
Thanks for the tip. Just a small correction: I had to use setopt no_histverify (without the second underscore) for it to work. This is with zsh 5.0.2. –  zzamboni Apr 7 at 16:22

Your Answer

 
discard

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.