Cancel permanently vi

I use vi (not Vim) and I would like to constantly undo the changes made. u works to cancel one command and u to cancel one line. But is there a way to permanently undo vim (I remember that a command in vim may even undo changes in time!) In vi? Thanks at Advance.

Edit: I am using vi version 3.10

+4
source share
2 answers

Repeat the cancellation with the key . .

+1
source

May not work in version 3.1.

Discard anything, e.g. drop the stack

 u . . . 

Suppose you write hello in insert -mode. Go to normal mode, write hallo and go to normal mode. Then enter u . you get hello . Enter again . and you will get empty. You can change it by typing u . . again u . . u . . to get hello hallo . It is very easy to remember, because it works like stacks! That is, undo repeat the last command repeat the last command , where repeating the last command may be undo . When you press uu , it means undo the last command : undo last command , and the second u means undo the last command and in this case it is u .

Tested with Nvi Version 1.79 (10/23/96) The CSRG, University of California, Berkeley , OpenBSD. You can get the source here .

+1
source

Source: https://habr.com/ru/post/1313056/


All Articles