How to go back (ctrl+z) in vi/vim

Slazer picture Slazer · Sep 15, 2012 · Viewed 160.5k times · Source

In normal text editors [with all due respect to Vim] there is a shortcut Ctrl+Z when you have done something nasty and want to return to the previous version of the text. Like BACK button in Word. I wonder how can you achieve this behaviour in Vim.

Answer

Qiau picture Qiau · Sep 15, 2012

You can use the u button to undo the last modification. (And Ctrl+R to redo it).

Read more about it at: http://vim.wikia.com/wiki/Undo_and_Redo