Undo and Redo (AKA "Don't Panic.")

Don't panic.

You have undo/redo

The command for undo is u. That's not too hard to remember, is it? A lot of VIM commands are pretty mnemonic-friendly.

The redo would be the r key, but the r is used for "replace" (we'll talk later about this). We're stuck with control-R instead. Ah, well. You can't have everything.

There is a lot more to undo and redo, but this is enough. Be happy that you can revert changes, and un-revert them. VIM isn't as powerless and unforgiving as you feared it might be, though you might still not like it very much. Just wait for that muscle memory to kick in.

If you get into a real mess, then exit the editor without saving.

If you are really afraid, or really cautious, then you should have version control for your text files.

I recommend you start editing with junk files in a junk directory anyway, but when you are working on something important, you should not be afraid to make changes.

Version control is a good security blanket and a useful backup strategy.

Consider using Git or Mercurial, both of which are worth knowing.

No comments:

Post a Comment