In zsh with oh-my-zsh you can enter a history expansion command and press either space, tab, or enter, and it will expand out. For example:
ls /path/to/some/directory cd !$<enter>
would expand to
But it does not actually execute the command. It remains on the prompt for further editing and you need to press enter a second time to actually run the command.
I was installing arch linux last night and found that the zsh settings the install shell comes with has history expansion on tab and space, but pressing enter runs the expanded command immediately without requiring the user to press enter again.
This is what I want because it saves me a key press. If I want to edit the expansion, I could press tab. If I want to run the command immediately I could press enter.
I think it's something to do with
magic-space, and I see the following line in
bindkey ' ' magic-space # [Space] - do history expansion
But I can't find where
tab are also bound to expansion or if there's some option to run the command immediately on enter.