Running a subshell from the middle of the current command

command linezsh

I frequently find my self in this scenario. I'm in the middle of typing a command and I need to check something else before I complete it.

Is there a way to open a subshell of some sort with my current input so far being remembered, then when I exit this subshell I'm back to where I was?

$ mylongcommand -n -e <SOME KEY COMBINATION WHICH OPENS A SUBSHELL>
$ date
...
$ exit
$ mylongcommand -n -e <BACK TO WHERE I WAS>

I'm using zsh

Best Answer

There is the key combination EscQ which saves the command buffer and allows to enter a new command. After running the command the buffer contains what you typed before. If you have to run another command before finishing this you can type EscQ again.

(I didn't try to open a subshell after pressing EscQ yet.)

See http://zsh.sourceforge.net/Intro/intro_10.html and search for "esc-q"