When editing a command in Terminal, you can type Control-X, Control-E to open it in your text editor of choice (via Wesley Darlington). When you save your changes and close the document, the command is executed.
I have my editor set to BBEdit via this line in ~/.bash_profile:
export EDITOR="bbedit -w"