Today I leared about
Press it while on the command line to write a (complex) command in your
After you are done editing the command you'll be brought back to the command line with the command you just wrote ready to be fired.
A similar functionality is offered by
fc you can edit and run commands from your history.
By the way, commandlinefu has more command line tricks worth checking out.