Try doing it with :#s///
Type a command, but don't press enter, e.g.
echo 'hello';
Type !#:s/hello/world/
Press enter. !# means the whole current command so far, and the s/a/b/ modifier replaces the first instance of "a" with "b".Press up to get the command that ran:
echo 'hello'; echo 'world';
To see such history expansion things before they are run, press M-^ (probably Alt-Shift-6).