10

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?

1 Answer 1

11

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

1
  • 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. Apr 7, 2014 at 16:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .