Evil, Aquamacs, ctrl-w, and undo

Vegard Øye vegard_oye at hotmail.com
Wed Oct 5 14:47:55 CEST 2011


On 2011-10-05 12:16 +0200, Alan Schmitt wrote:

> On 5 oct. 2011, at 11:57, Alan Schmitt wrote:
>
>> I'm writing some text, in insert mode, and I want to go to the next
>> window. So I hit "ctrl-w ctrl-w", and it deletes to words as I
>> forgot to get out of insert mode. The problem is I cannot undo
>> this: if I get to normal mode and do "u", I get back further in the
>> history. If I do a redo (ctrl-r), I cannot get the words back.

By default, Evil treats an insertion as a single undo step. You can
disable this with `evil-want-fine-undo':

    (setq evil-want-fine-undo t)

That leaves undo boundaries up to Emacs, resulting in a more
"fine-grained" undo.

> I put this in my .emacs file:
> (global-unset-key "\C-w")
>
> and it did not work.

To change the Insert state binding of "C-w", modify
`evil-insert-state-map':

    (define-key evil-insert-state-map "\C-w" 'undefined)

That makes "C-w" do nothing in Insert state. Alternatively:

    (define-key evil-insert-state-map "\C-w" 'evil-window-map)

That gives you window navigation in Insert state as well.

-- 
Vegard



More information about the implementations-list mailing list