These are some awesome options: emacs-24, evil-mode (using vim bindings in emacs), and undo-tree.
However, when I'm in edit mode (insert mode), I sometimes jump around for a number inserts, deletes, etc. before hitting escape and leaving insert mode.
"Undo" takes the whole insert (including deletes) as one edit. For example, I can't undo the paragraph I accidentally deleted without undo'ing the whole delete!
Is there any way to fix this?
Here are some related links:
- How Emacs determines a unit of work to undo
- http://vim.wikia.com/wiki/Using_undo_branches
- http://vim.wikia.com/wiki/Modified_undo_behavior
- This tip probably has best explanation from the vim side.
Here are the vim mappings that convert certain vim commands so that they can be undone:
inoremap <c-u> <c-g>u<c-u>
inoremap <c-w> <c-g>u<c-w>
inoremap <End> <C-g>u<End>
inoremap <BS> <c-g>u<BS>
inoremap <CR> <c-g>u<CR>
inoremap <del> <c-g>u<del>
What is needed is for the undo mode inside of emacs evil undo-tree to track additional events besides just leaving insert mode. For example, you should be able to stay in insert mode a long time and then undo any sort of delete, cut, paste.