vi undo and repeat
In command mode, to undo the last command u is used and if you want to repeat the last command use dot (.).
This command allows us to undo or cancel our last command.
Look at the above snapshot, this is our script.
Look at the above snapshot, with the help of dG command we have deleted last lines.
Look at the above snapshot, after pressing u, last command dG disables and all the content came back.
The . command allows us to repeat last used command.
Look at the above snapshot, we have used D command to delete some part of line second.
Look at the above snapshot, after pressing . same D command is repeated on line four.