Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is fast (repeated) undo possible in emacs?

Tags:

undo

emacs

editor

I use emacs and I have a problem with it's undo.

(Sorry, maybe this is a stupid question, but I did not find anything about it in the internet, whilst it should be a basic functionality of any editor).

To invoke each undo step I need to press 'Ctrl-x' and then 'u'. But if I have done 200 steps and I wish to undo them, my hand and fingers get horrible pain from repeating 'Ctrl-x' and then 'u' 200 times, to say nothing that this operation takes about 5 minutes.

In Microsoft Word, for example (and also in many other editors) undo is Ctlr-Z, but you can press and hold Ctlr-Z and multiple undo steps run fast. Is this achievable in emacs?

like image 257
Andrey Rubliov Avatar asked Mar 05 '13 16:03

Andrey Rubliov


People also ask

How do I redo undo in Emacs?

Just move the cursor in any direction, and type C-x u again. Emacs redoes the last command you undid. You can repeat it to redo previous undos.

How do you redo in Emacs?

in plain emacs, to redo, just press Ctrl + g first then undo. Further undo will be redo. Press Ctrl + g again to reverse direction.


3 Answers

Hold down Alt, type 2 0 0, then press CTRL+x u.

This gives an argument of 200 to the operation you are going to perform next (e.g. undo), so it applies that operation 200 times.

By the way, CTRL+/ is also mapped to "undo", if you would like to use fewer keystrokes.

like image 59
kes Avatar answered Oct 23 '22 04:10

kes


ctrl + / is essentially the same as the MS Word functionality.

like image 40
brbcoding Avatar answered Oct 23 '22 02:10

brbcoding


Finally I found additional way of doing so: C-x u C-x z z z z z

But ctrl / is easier.

Many thanks to brbcoding

like image 4
Andrey Rubliov Avatar answered Oct 23 '22 02:10

Andrey Rubliov