spacemacs icon indicating copy to clipboard operation
spacemacs copied to clipboard

Restore emacs' default undo/redo behavior in spacemacs

Open oneself opened this issue 4 years ago • 4 comments

I've recently moved to spacemacs and it seems that they've adopted a different undo package (undo-tree) which I don't like since it does not push the undo actions back onto the history stack. I would like to restore the default behavior but I can't seem to figure out how to do this.

C-/ is bound to undo-tree-undo in spacemacs. I've tried to unbind this and use emacs' undo instead, but that does't seem to work. I've added the following in my user-config.el:

(global-unset-key (kbd "C-/"))
(global-set-key (kbd "C-/") 'undo)

But the key remains bound to the undo-tree method. I've also tried bind it to a new key, but the same seems to happen. It's as if spacemacs redirects call to for undo to undo-tree-undo. Is there anyway to fix this? Thank you.

oneself avatar Feb 21 '21 15:02 oneself

It seems to work to restore the default undo:

 C-/                    ;; undo

By adding:

(global-undo-tree-mode -1)

to the dotspacemacs/user-config section in .spacemacs. .spacemacs can be opened by pressing SPC f e d (or with the Emacs key bindings: M-m f e d)

duianto avatar Feb 21 '21 16:02 duianto

I was able to get this working on emacs28 with:

(global-undo-tree-mode -1)
(evil-set-undo-system 'undo-redo)

Without the 2nd, undo wouldn't work. This requires emacs28 off git, since undo-redo is a new built-in, but it already has native support in evil-undo now!

I've only been using this for an hour or two, but so far it seems dramatically faster. I wonder if we should promote this as a first-class choice in spacemacs?

bhipple avatar May 31 '21 16:05 bhipple

@oneself Please try the workaround by @bhipple https://github.com/syl20bnr/spacemacs/issues/14406#issuecomment-851597233

lebensterben avatar Aug 24 '21 01:08 lebensterben

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

github-actions[bot] avatar Aug 28 '22 12:08 github-actions[bot]