Press Ctrl-x, Ctrl-e in the terminal when writing a long command.
So you can edit it (in multi-line mode) with your favorite editor.
The Bash manual’s section on miscellaneaous commands: reference
edit-and-execute-command (C-x C-e)
Invoke an editor on the current command line, and execute the result as shell commands. Bash attempts to invoke $VISUAL, $EDITOR, and emacs as the editor, in that order.