Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Undo many times in Vim?

Tags:

vim

Suppose state A in my document, I make change to B, C then D. Now I typed 'u', the state goes to C. I type 'u' again it goes back to D. (the second undo looks like redo to me).

In my understanding, undo means that I undo it once it will return to C, then undo again to it will return to B then undo again it will return to A.

Also, I know 'u3' can work here but in most cases I have no way to keep track of the number of state changes.

How can I achieve unlimited undo in Vim?

like image 448
assiegee Avatar asked Mar 16 '15 21:03

assiegee


1 Answers

You have only 1 level of undo if you are in Vi compatible mode. You are missing out on a number of features by being in 'compatible' mode. Just create a ~/.vimrc file and you will automatically disable 'compatible' mode.

What wonderful undo features do you get by using 'nocompatible'?

  • Unlimited undo
  • Persistent undo
  • Undo branches (like an undo tree)
like image 102
Peter Rincker Avatar answered Sep 23 '22 14:09

Peter Rincker