I would like to use the expansion mv 'foo bar' !#:1:s^\ ^-^
to produce the command mv 'foo bar' 'foo-bar'
. However when I press the space bar, zsh assumes I've finished typing the expansion, leaving me with mv 'foo bar' !#:1:s^\
which yields mv 'foo bar' 'foobar'
.
I can circumvent this behavior by typing mv 'foo bar' !#:1:s^\^-^
and then backtracking with the arrow keys to obtain mv 'foo bar' !#:1:s^\ ^-^
, but that defeats the purpose.
How can I just turn off the expand-on-spacebar behavior? I suppose my desired behavior is to leave the command un-expanded until I press Enter. I didn't find anything on this in the manpage for zshexpn
.
Edit: I've found that I can type mv 'foo bar' !{#:1:s^\ ^-^}
, which holds off the expansion until the }
is typed. But the question of how to prevent the expand-on-spacebar behavior stands.