For evil-mode, I did a package in the past, it should be on melpa: https://github.com/VanLaser/evil-nl-break-undo
Emacs
A community for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!
Get Emacs
Rules
- Posts should be emacs related
- Be kind please
- Yes, we already know: Google results for "emacs" and "vi" link to each other. We good.
Emacs Resources
Emacs Tutorials
- Beginner’s Guide to Emacs
- Absolute Beginner's Guide to Emacs
- How to Learn Emacs: A Hand-drawn One-pager for Beginners
Useful Emacs configuration files and distributions
Quick pain-saver tip
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.
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.
the paragraph here gives some useful details: https://www.gnu.org/software/emacs/manual/html_node/elisp/Undo.html#index-undo_002dauto_002damalgamate
The editor command loop automatically calls undo-boundary just before executing each key sequence, so that each undo normally undoes the effects of one command. A few exceptional commands are amalgamating: these commands generally cause small changes to buffers, so with these a boundary is inserted only every 20th command, allowing the changes to be undone as a group. By default, the commands self-insert-command, which produces self-inserting input characters (see User-Level Insertion Commands), and delete-char, which deletes characters (see Deleting Text), are amalgamating.
this means emacs will group together a certain number of inserted characters into an atomic unit; it's that unit which is undone by the undo
command. if you want character-by-character undo then you will need to tell emacs to not perform this grouping. one thing to try would be to add advice to the insert-char
function to set that undo boundary for you upon each keystroke; I'm sure there are other ways to do this as well.
The following paragraph from what you quote has the heavy handed approach whereby no changes are amalgamated and undo would work character by character.
The maximum number of changes that can be amalgamated is controlled by the amalgamating-undo-limit variable. If this variable is 1, no changes are amalgamated.
paste this in chat gpt and go from there?
I used to have these vim bindings in vim
how do i write emacs lisp to do this same stuff in evil-mode
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
I got something like this: