this post was submitted on 19 Oct 2023
1 points (100.0% liked)

Emacs

311 readers
1 users here now

A community for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!

Get Emacs

Rules

  1. Posts should be emacs related
  2. Be kind please
  3. Yes, we already know: Google results for "emacs" and "vi" link to each other. We good.

Emacs Resources

Emacs Tutorials

Useful Emacs configuration files and distributions

Quick pain-saver tip

founded 1 year ago
MODERATORS
 

I'm an Emacs newbie (using Doom Emacs with GNU Emacs 29.1). I came from vim, and battling with undo there was crazy enough, but I won using this:

inoremap  u
inoremap  u
inoremap  u
inoremap  u
inoremap  u
inoremap  u
inoremap  u
inoremap , ,u
inoremap . .u
inoremap ( (u
inoremap [ [u
inoremap = =u
inoremap \" \"u
inoremap  u
inoremap  u

Also, I had autogroup that breaks undo every 4 seconds.

Basically, this configuration breaks undo on almost every possible type command, every Spacebar, Enter, comma, bracket, moving up, down, everything. This is because I hate when undo deletes the whole screen of text.

How do I replicate this in Emacs? I read this, but it doesn't say what is considered a "recent change".

you are viewing a single comment's thread
view the rest of the comments
[–] FrozenOnPluto@alien.top 1 points 1 year ago (1 children)

Emacs is king of undo. Theres a number of ways but you can bsck up the undo chain a step or steps at a time. Ie if you’ve done 20 changes you can just keep going back with a keystroke.

There is also undo-tree package so you can visually see what state your buffer has been in over time and then just go pick the state you want.

[–] SnooPets20@alien.top 1 points 1 year ago

Do note that undo-tree not only provides a visual, it is a fundamentally different way of doing undos. The stock emacs way is not a tree, it's a line. There's no real "redo" in emacs for instance, you just undo an undo. It's odd, but undo tree works really well.