Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I recently made the switch from bash to zsh. I discovered two minuscule issues and differences between zsh and bash. I was slightly disappointed when my favorite two shortcuts !! & !$ don't behave as they do in bash.

When I try to the following with the argument shortcuts (sorry I don't know what they're formally called) they would automatically execute like the following in bash:

$ touch foo
$ vim !$
<file opens immediately>

While in zsh they become translated then executed (I have to hit enter one extra time):

$ touch foo
$ vim !$
$ vim foo

Is there a way to have !$ & !!, in zsh, behave the same way as it does in bash?

share|improve this question
add comment

1 Answer

up vote 7 down vote accepted

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.

To disable this option run setopt no_hist_verify. You can also have a look at your config file and remove the hist_verify option or just explicitly disable it.

share|improve this answer
add comment

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.