Made a mistake while editing a file with Vim Donapost worry you can undo the changes in Vim and if you want you can redo the changes as well.

And itaposs pretty simple too. .

It cannot be simpler than this can it To remember u stands for undo and r stands for redo.

Letaposs go a bit in detail.

Vim maintains the record of changes in a stack in LIFO last in first out format. Whenever you make any change it gets added in the stack. When you undo it the last change gets undone first.

Letaposs take an example. I have this file where I have deleted line 3 and 6 in the same order.

To undo the changes I go to the command mode by pressing Esc key and then press the u key. As you can see it brings back the line number 6 first. Vim even shows the information about the undone change at the bottom.

...

Read Full Post

News Link: https://linuxhandbook.com/undo-redo-vim/.

Linux Chatter is a news aggregator service that curates some of the best Linux, Cloud, Technical Guides, Hardware and Security news. We display just enough content from the original post to spark your interest. If you like the topic, then click on the 'read full post' button to visit the author's website. Use Linux Chatter to find content from amazing authors!

Note: The content provided has been modified and is not displayed as intended by the author. Any trademarks, copyrights and rights remain with the source.

Disclaimer: Linux Chatter sources content from RSS feeds and personal content submissions. The views and opinions expressed in these articles are those of the authors and do not necessarily reflect those of Linux Chatter.