这篇文章说“Emacs有重做,因为你可以在撤销的时候反转方向,从而撤销撤销”。

这是什么意思?用户如何使用Emacs“重做”?


当前回答

我找到了重做。el非常方便地执行“正常的”撤销/重做,我通常将它绑定到C-S-z和撤销到C-z,就像这样:

(when (require 'redo nil 'noerror)
    (global-set-key (kbd "C-S-z") 'redo))

(global-set-key (kbd "C-z") 'undo)

只需下载该文件,将其放在lisp路径中,并将上述文件粘贴到您的.emacs中。

其他回答

默认情况下,Emacs中的重做需要按C-g,然后撤销。

但是也可以使用Emacs内置的undo来实现重做命令。

undo-fu包使用Emacs内置的撤销功能来公开撤销和重做。


编辑,撤销fu现在已经集成到邪恶模式(如果你是一个邪恶模式的用户)。

例子:

(use-package undo-fu)
(use-package evil
  :init
  (setq evil-undo-system 'undo-fu))

Emacs 28添加了一个重做命令(称为撤消重做)。

如果您想要更典型的撤消/重做,可以使用以下命令。

(global-set-key (kbd "C-z") 'undo-only)
(global-set-key (kbd "C-S-z") 'undo-redo)

要访问此功能(也可以使用非线性历史记录,请参阅undo-fu,这是内置在undo中的emacs上的精简包装器)。

我找到了重做。el非常方便地执行“正常的”撤销/重做,我通常将它绑定到C-S-z和撤销到C-z,就像这样:

(when (require 'redo nil 'noerror)
    (global-set-key (kbd "C-S-z") 'redo))

(global-set-key (kbd "C-z") 'undo)

只需下载该文件,将其放在lisp路径中,并将上述文件粘贴到您的.emacs中。

对于那些想要拥有更常见的撤消/重做功能的人,有人编写了undo-tree.el。它提供了非emacs撤消的外观和感觉,但提供了对撤消历史的整个“树”的访问。

我喜欢Emacs的内置撤销系统,但发现这个包非常直观。

以下是该文件本身的评论:

Emacs has a powerful undo system. Unlike the standard undo/redo system in most software, it allows you to recover any past state of a buffer (whereas the standard undo/redo system can lose past states as soon as you redo). However, this power comes at a price: many people find Emacs' undo system confusing and difficult to use, spawning a number of packages that replace it with the less powerful but more intuitive undo/redo system. Both the loss of data with standard undo/redo, and the confusion of Emacs' undo, stem from trying to treat undo history as a linear sequence of changes. It's not. The `undo-tree-mode' provided by this package replaces Emacs' undo system with a system that treats undo history as what it is: a branching tree of changes. This simple idea allows the more intuitive behaviour of the standard undo/redo system to be combined with the power of never losing any history. An added side bonus is that undo history can in some cases be stored more efficiently, allowing more changes to accumulate before Emacs starts discarding history.

在末日emacs中, 按Ctrl + Shift + -取消 Alt + Shift + -重做