Some commands outgrow the prompt. A find with four tests, or a for loop squeezed onto one line. Fixing a typo halfway through that with the arrow keys is slow, and bash already has a better way built in.
Type or paste the command, and before you press Enter, press this:
Ctrl-x Ctrl-e
That’s Ctrl-x followed by Ctrl-e. Bash opens the current command line in your editor. It tries $VISUAL first, then $EDITOR, and falls back to emacs when neither is set. Edit the command, save, quit, and bash runs whatever you saved. If you’d rather land in nano than in emacs, put this in your ~/.bashrc:
export EDITOR=nano
Say you pulled a long rsync line out of your history with the up arrow, and you want a different destination and a --dry-run in front of it. Press Ctrl-x Ctrl-e, jump to the right spot with your editor’s search, make both changes and save. Because bash runs the saved file as shell commands, you can also spread the thing over several lines, or turn a one-liner into a proper loop with indentation while you’re in there. I’d reach for this every time a command gets longer than the terminal is wide.
The caveat: saving is the same as pressing Enter. There’s no confirmation, so if you open the editor and change your mind, delete all the lines before you quit and nothing runs. This is the default key binding of bash’s emacs editing mode. If you switched to set -o vi, the binding is different. Also keep in mind that the Terminal on a Mac starts zsh these days, not bash, so on my MacBook this tip only applies inside a bash shell, for example over SSH on a Linux box or the Unraid console.
Further reading: bash(1) manual page