Lets play with various delete command combination available on vim/ neovim.
Start with blank buffer and place some text on it (with some mistakes we intend to fix).
Here we have 2 identical line with “Line 5” and we plan to delete one of them. Move the cursor to the line to be deleted and press d then d. This wil delete the line.
To delete a character on the cursor press x. Next we will fix “Line a2” and “Line a3” also on line 4 and 6.
To delete a word until the next word place the cursor on the beginning of the word and press d w. This fix line 7 by deleting a “line ” word. The w command here is a movement command it will move the cursor to next word. The d command can be combined with movement command.
To fix line 8 we will combine delete command with $ command. $ command is move to end of line command. Place cursor on 2nd 8 char then press d $.
One thing about delete is anything you delete can be put back using p command (put).
Lets delete Line 9 with d d command and move cursor to line 4.
Press p to put back last deleted item.
To delete multiple line we can prefix d d with number of line to delete. Try 3 d d.
We can do also for word delete, example d 3 w will delete 3 words. To undo press u. Undo will return our 3 deleted lines.
To undo more than 1 time u can do :u command followed by a number. Lets do :u 2.
To redo use :redo.
Bye for now.