Hacker News new | ask | show | jobs
by benvd 3573 days ago
>I don't use !!, or !$, because I prefer to see what command is being executed before I press enter.

I use zsh (with oh-my-zsh) and when I type e.g. "sudo !!" and press enter, it doesn't execute the command, instead it expands the !!. Another enter will then actually execute it.

I believe it's default behavior for oh-my-zsh. At least, I don't recall manually changing this.

5 comments

This is achieved in bash by shopt -s histverify

I don't use history expansions, though, so YMMV

In zsh you can type !!<tab> and it will auto-expand the line for you. I find histverify to be kind of annoying so I don't use it.
How so?
I think by default in vanilla zsh, will expand something like 'sudo !!' by hitting tab after the second bang.
You are correct.
Same behavior on zsh with prezto.