Bob Nnamtrop | 30 May 2012 16:04
Picon

rebinding C-w

I am used to the emacs windowing commands so I'd like to rebind C-w in
normal state to the usual emacs binding (kill-region) or the evil
"equivalent" (evil-delete). Is there a better choice here? However,
the usual way does not work:

(define-key evil-normal-state-map "\C-w" 'kill-region)

It doesn't matter if it is before or after (require 'evil). What am I
doing wrong?

Thanks,
Bob
Barry OReilly | 30 May 2012 17:22
Picon

Re: rebinding C-w

What does it show when you do: C-h k C-w

I've found I generally need to look at what's in the
evil-motion-state-map and evil-normal-state-map and make them
consistent.  See evil-maps.el for the stock key bindings.  As
described in evil-core.el: "Normal state inherits bindings from Motion
state".  Thus, you might need to: (define-key evil-motion-state-map
"\C-w" nil)

On 5/30/12, Bob Nnamtrop <bobnnamtrop <at> gmail.com> wrote:
> I am used to the emacs windowing commands so I'd like to rebind C-w in
> normal state to the usual emacs binding (kill-region) or the evil
> "equivalent" (evil-delete). Is there a better choice here? However,
> the usual way does not work:
>
> (define-key evil-normal-state-map "\C-w" 'kill-region)
>
> It doesn't matter if it is before or after (require 'evil). What am I
> doing wrong?
>
> Thanks,
> Bob
>
> _______________________________________________
> implementations-list mailing list
> implementations-list <at> lists.ourproject.org
> https://lists.ourproject.org/cgi-bin/mailman/listinfo/implementations-list
>
Bob Nnamtrop | 30 May 2012 23:19
Picon

Fwd: rebinding C-w

It says its bound to kill-region, but when I select a region and try
to use it a C-w is echoed to the mini-buffer and emacs waits.

Bob

---------- Forwarded message ----------
From: Barry OReilly <gundaetiapo <at> gmail.com>
Date: Wed, May 30, 2012 at 9:22 AM
Subject: Re: rebinding C-w
To: vi/Vim emulation in Emacs <implementations-list <at> lists.ourproject.org>

What does it show when you do: C-h k C-w

I've found I generally need to look at what's in the
evil-motion-state-map and evil-normal-state-map and make them
consistent.  See evil-maps.el for the stock key bindings.  As
described in evil-core.el: "Normal state inherits bindings from Motion
state".  Thus, you might need to: (define-key evil-motion-state-map
"\C-w" nil)

On 5/30/12, Bob Nnamtrop <bobnnamtrop <at> gmail.com> wrote:
> I am used to the emacs windowing commands so I'd like to rebind C-w in
> normal state to the usual emacs binding (kill-region) or the evil
> "equivalent" (evil-delete). Is there a better choice here? However,
> the usual way does not work:
>
> (define-key evil-normal-state-map "\C-w" 'kill-region)
>
> It doesn't matter if it is before or after (require 'evil). What am I
> doing wrong?
(Continue reading)

Barry OReilly | 31 May 2012 00:49
Picon

Re: rebinding C-w

Select the region and then do C-h k C-w

If you're entering the visual state, you should probably put your key
binding in the evil-motion-state-map instead.

On 5/30/12, Bob Nnamtrop <bobnnamtrop <at> gmail.com> wrote:
> It says its bound to kill-region, but when I select a region and try
> to use it a C-w is echoed to the mini-buffer and emacs waits.
>
> Bob
>
>
> ---------- Forwarded message ----------
> From: Barry OReilly <gundaetiapo <at> gmail.com>
> Date: Wed, May 30, 2012 at 9:22 AM
> Subject: Re: rebinding C-w
> To: vi/Vim emulation in Emacs <implementations-list <at> lists.ourproject.org>
>
>
> What does it show when you do: C-h k C-w
>
> I've found I generally need to look at what's in the
> evil-motion-state-map and evil-normal-state-map and make them
> consistent.  See evil-maps.el for the stock key bindings.  As
> described in evil-core.el: "Normal state inherits bindings from Motion
> state".  Thus, you might need to: (define-key evil-motion-state-map
> "\C-w" nil)
>
>
>
(Continue reading)

Bob Nnamtrop | 31 May 2012 02:20
Picon

Re: rebinding C-w

Yes, you are right. Changing it to evil-motion-state-map fixes it. Thanks.

Is there any reason to bind C-w to evil-delete versus delete-region?

Bob

On Wed, May 30, 2012 at 4:49 PM, Barry OReilly <gundaetiapo <at> gmail.com> wrote:
> Select the region and then do C-h k C-w
>
> If you're entering the visual state, you should probably put your key
> binding in the evil-motion-state-map instead.
>
>
>
> On 5/30/12, Bob Nnamtrop <bobnnamtrop <at> gmail.com> wrote:
>> It says its bound to kill-region, but when I select a region and try
>> to use it a C-w is echoed to the mini-buffer and emacs waits.
>>
>> Bob
>>
>>
>> ---------- Forwarded message ----------
>> From: Barry OReilly <gundaetiapo <at> gmail.com>
>> Date: Wed, May 30, 2012 at 9:22 AM
>> Subject: Re: rebinding C-w
>> To: vi/Vim emulation in Emacs <implementations-list <at> lists.ourproject.org>
>>
>>
>> What does it show when you do: C-h k C-w
>>
(Continue reading)

Frank Fischer | 31 May 2012 08:21
Picon

Re: rebinding C-w

On Wed, May 30, 2012 at 06:20:18PM -0600, Bob Nnamtrop wrote:
> Yes, you are right. Changing it to evil-motion-state-map fixes it. Thanks.
> 
> Is there any reason to bind C-w to evil-delete versus delete-region?
> 

Usually Evil commands work better with other parts of Emacs like the
repeat system, registers, ... Furthermore `evil-delete' can deal with
block visual state (and line visual state), `delete-region' cannot.

Frank

Gmane