3

I really appreciate the undo in region command in standard emacs, where you can just mark a region and only changes made in that region are undone.

This doesn't seem to work in the default spacemacs configuration.

Is there a way to activate this?

1

You can select the region and do, either: SPC SPC undo or C-_ that is Control-shift--key

or even better, you can create your own keymap under SPC o that's reserved for user keybindings, and create SPC o u for undo:

(spacemacs/declare-prefix "o" "personal")

;; File bindings
(spacemacs/set-leader-keys
  "ou" 'undo)
|improve this answer|||||
  • Thanks. The C-_ command works, but the marked region extends after the first time I press it (weird, but not the end of the world). SPC SPC undo doesn't do this, oddly enough. – tom4everitt Apr 24 '17 at 0:22
  • Also, it seems like a shorter undo history is kept then before. If I edit a region, then do an undo and redo somewhere else, the undo-history for the original region seems to be lost. – tom4everitt Apr 24 '17 at 0:30
  • Actually, I can't reliably reproduce it now. Never mind. I'll post a new question if I manage to. – tom4everitt Apr 24 '17 at 0:42
1

(define-key evil-visual-state-map (kbd "u") 'undo)

It will bind u to Emacs undo command in evil visual state (aka when you select region).

|improve this answer|||||
  • Thanks for your answer, would you mind adding some explanation to increase its usefullness? – JeanPierre Apr 23 '17 at 21:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.