Evil, Aquamacs, ctrl-w, and undo
Hello, I've been bitten by this several times, and I'm wondering if this is a bug or if it's something I'm doing wrong. 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. (I also tried doing "cmd-z" without leaving insert mode, and the problem is the same.) Looking at the key description, it's bound to "aquamacs-backward-kill-word". I'm going to try to unbind it, but I'm wondering if the fact that I cannot undo this action is a bug. Thanks, Alan
On 5 oct. 2011, at 11:57, Alan Schmitt wrote:
I'm going to try to unbind it
I thought this would be easy, but for some reason it does not work. I put this in my .emacs file: (global-unset-key "\C-w") and it did not work. I even tried to evaluate it (C-x C-e), and it still does not remove the binding. Am I doing something wrong? Thanks, Alan
On Wed, Oct 05, 2011 at 12:16:11PM +0200, Alan Schmitt wrote:
On 5 oct. 2011, at 11:57, Alan Schmitt wrote:
I'm going to try to unbind it
I thought this would be easy, but for some reason it does not work.
I put this in my .emacs file: (global-unset-key "\C-w")
and it did not work. I even tried to evaluate it (C-x C-e), and it still does not remove the binding.
Am I doing something wrong?
The problem is that the whole change you make during insert-state is recorded as a single undo. In order to inhibit C-w you could use something like (define-key evil-insert-state-map (kbd "C-w") 'undefined) Frank
On 5 oct. 2011, at 13:19, Frank Fischer wrote:
The problem is that the whole change you make during insert-state is recorded as a single undo.
Is this usual vim behavior?
In order to inhibit C-w you could use something like
(define-key evil-insert-state-map (kbd "C-w") 'undefined)
Thanks, it put me on the right direction. I have added (define-key evil-insert-state-map (kbd "C-w") 'evil-window-map) to my .emacs and it does what I want. I just tested with vim and there as well C-w is backward delete word. I had never noticed. Alan
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
participants (3)
-
Alan Schmitt -
Frank Fischer -
Vegard Øye