On most POSIX systems you can use fc(1) to edit a command in
your $EDITOR. In vi(1) and friends you can then use "%!ls"
to replace the contents of the buffer with directory listing
and edit the commands you want.
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/f...
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/v...