zsh-users
 help / color / mirror / code / Atom feed
* [vi-mode] mapping <esc> (`\e') in visual mode in zsl vi-mode
@ 2016-06-21 17:09 Filipe Silva
  2016-06-21 17:26 ` Oliver Kiddle
  2016-06-21 17:35 ` Bart Schaefer
  0 siblings, 2 replies; 4+ messages in thread
From: Filipe Silva @ 2016-06-21 17:09 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 215 bytes --]

Hi,

How can I bind the <ESC> key, in zle vi-mode visual mode? I want that
pressing <esc> in visual mode switches to vi-normal mode.

this does not work:

```
bindkey -M visual '\e' vi-cmd-mode
```

cheers,

Filipe

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [vi-mode] mapping <esc> (`\e') in visual mode in zsl vi-mode
  2016-06-21 17:09 [vi-mode] mapping <esc> (`\e') in visual mode in zsl vi-mode Filipe Silva
@ 2016-06-21 17:26 ` Oliver Kiddle
  2016-06-21 17:35   ` Filipe Silva
  2016-06-21 17:35 ` Bart Schaefer
  1 sibling, 1 reply; 4+ messages in thread
From: Oliver Kiddle @ 2016-06-21 17:26 UTC (permalink / raw)
  To: Filipe Silva; +Cc: zsh-users

Filipe Silva wrote:
>
> How can I bind the <ESC> key, in zle vi-mode visual mode? I want that
> pressing <esc> in visual mode switches to vi-normal mode.
>
> this does not work:
>
> bindkey -M visual '\e' vi-cmd-mode

A deactivate-region widget was added in 5.1 so you must be using 5.0.8.

If you're stuck with 5.0.8, you can define your own:
  deactivate-region() {
      REGION_ACTIVE=0
  }
  zle -N deactivate-region
  bindkey -M visual '\e' deactivate-region

Otherwise, I'd recommend upgrading.

Oliver


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [vi-mode] mapping <esc> (`\e') in visual mode in zsl vi-mode
  2016-06-21 17:09 [vi-mode] mapping <esc> (`\e') in visual mode in zsl vi-mode Filipe Silva
  2016-06-21 17:26 ` Oliver Kiddle
@ 2016-06-21 17:35 ` Bart Schaefer
  1 sibling, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 2016-06-21 17:35 UTC (permalink / raw)
  To: Filipe Silva; +Cc: Zsh Users

On Tue, Jun 21, 2016 at 10:09 AM, Filipe Silva <filipe.silva@gmail.com> wrote:
>
> How can I bind the <ESC> key, in zle vi-mode visual mode? I want that
> pressing <esc> in visual mode switches to vi-normal mode.

Back in February, I wrote:
>
> As presently
> implemented, visual mode is a combination of a couple of different
> states that can each be changed independently; the determination of
> whether this "mode" is in effect is not made until the last instant
> before ZLE waits for the next keystroke, and is forgotten as soon as
> the keystroke has been consumed.  The keymap isn't even in place long
> enough for the corresponding widget to see it; it's indistinguishable
> from vicmd mode.

The consequence of this is that the only way to "end visual mode" is
(as Oliver just pointed out) to deactivate the region.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [vi-mode] mapping <esc> (`\e') in visual mode in zsl vi-mode
  2016-06-21 17:26 ` Oliver Kiddle
@ 2016-06-21 17:35   ` Filipe Silva
  0 siblings, 0 replies; 4+ messages in thread
From: Filipe Silva @ 2016-06-21 17:35 UTC (permalink / raw)
  To: Oliver Kiddle; +Cc: zsh-users

[-- Attachment #1: Type: text/plain, Size: 750 bytes --]

I'm indeed temporarily stuck with 5.0.8 for the moment. But the workaround
solution worked nicely.

Thank you very much.



On Tue, Jun 21, 2016 at 2:26 PM, Oliver Kiddle <okiddle@yahoo.co.uk> wrote:

> Filipe Silva wrote:
> >
> > How can I bind the <ESC> key, in zle vi-mode visual mode? I want that
> > pressing <esc> in visual mode switches to vi-normal mode.
> >
> > this does not work:
> >
> > bindkey -M visual '\e' vi-cmd-mode
>
> A deactivate-region widget was added in 5.1 so you must be using 5.0.8.
>
> If you're stuck with 5.0.8, you can define your own:
>   deactivate-region() {
>       REGION_ACTIVE=0
>   }
>   zle -N deactivate-region
>   bindkey -M visual '\e' deactivate-region
>
> Otherwise, I'd recommend upgrading.
>
> Oliver
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-06-21 17:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-21 17:09 [vi-mode] mapping <esc> (`\e') in visual mode in zsl vi-mode Filipe Silva
2016-06-21 17:26 ` Oliver Kiddle
2016-06-21 17:35   ` Filipe Silva
2016-06-21 17:35 ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).