For an interactive edit I just use <ESC>-. to repeat the last parameter:
ls foo.txt
mv <ESC>-. <ESC>-. # and edit ls foo.txt
mv <ESC>-. <ESC>-. # and edit mv foo.txt
↑
Alt-.
That is: intentionally run mv with only one argument (the command fails but is recorded in the history), Up arrow to recall the last command, and Alt-dot (pastes the last argument).This is literally replacing an entire shell script with two key strokes (Up, Alt-.)
$ echo $BASH_VERSION
5.0.11(1)-release
$ mv foo.txt
mv: missing destination file operand after 'foo.txt'
Try 'mv --help' for more information.
$ mv foo.txt $BASH_VERSION # Alt-. pasted $BASH_VERSION instead of foo.txt