Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Vimode problem (key press dropping)
- X-seq: zsh-workers 36044
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: Vimode problem (key press dropping)
- Date: Mon, 10 Aug 2015 14:34:53 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1439210094; bh=eBOmshAQ+U1uQ8UYup6PRYWrAQWmvENTNAUfyWb9egc=; h=In-reply-to:From:References:To:Subject:Date:From:Subject; b=IWqhVPLQVH6XD51beYB94NMu4dcx6efi7yf3JqO5aERJ9ikv561vZuEK6vkqZjFXTRvKMcGJ65aiKGRpfjl+96lh03LUW5Ep24zGCDka/qyvrwaECFKEcRH4Z9+SBsmNyVgNqyUS5qFpNhj+V9gAQxetWI9ok4SBZQcGnamLYAWyqz1r7eb87N5RmSvSL9LjCLNcY8N7wS+fvQ3am6YB3qG2iADfHT76iN6EMxNA2BpH1r62jV1+ur1KHw6Px64rfQyyKREmq0ao3/ehh/YRFNe2ZtKggnmM9L1MxUz1IPeUqH0sgbF6vvjWMJggc54DnlIr+Y9GwEbvUxDBsRzTPw==
- In-reply-to: <150729082244.ZM10238@torch.brasslantern.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <5d9984411ba10dee4321a408e2763317@riseup.net> <9361.1438161965@thecus.kiddle.eu> <150729082244.ZM10238@torch.brasslantern.com>
On 29 Jul, Bart wrote:
> }
> } I also have escape bound to set REGION_ACTIVE=0 from the
> } visual keymap which should perhaps also be default behaviour (vim does
> } that).
>
> This seems reasonable to me.
This patch does that then, using deactivate-region as the name for the
new widget. I searched emacs documentation to see if it has something
similar, mainly to ensure consistent naming. It seems in emacs you have
to use Ctrl-G which is a more general command for aborting things.
Also note that set-mark-command with a negative argument will deactivate
the region but I don't think it is possible to bind to that directly.
Oliver
diff --git a/Src/Zle/iwidgets.list b/Src/Zle/iwidgets.list
index 657e4ef..2b2654c 100644
--- a/Src/Zle/iwidgets.list
+++ b/Src/Zle/iwidgets.list
@@ -35,6 +35,7 @@
"copy-prev-word", copyprevword, ZLE_KEEPSUFFIX
"copy-prev-shell-word", copyprevshellword, ZLE_KEEPSUFFIX
"copy-region-as-kill", copyregionaskill, ZLE_KEEPSUFFIX
+"deactivate-region", deactivateregion, 0
"delete-char", deletechar, ZLE_KEEPSUFFIX
"delete-char-or-list", deletecharorlist, ZLE_MENUCMP | ZLE_KEEPSUFFIX | ZLE_ISCOMP
"delete-word", deleteword, ZLE_KEEPSUFFIX
diff --git a/Src/Zle/zle_keymap.c b/Src/Zle/zle_keymap.c
index d355f41..c16e32e 100644
--- a/Src/Zle/zle_keymap.c
+++ b/Src/Zle/zle_keymap.c
@@ -1363,6 +1363,7 @@ default_bindings(void)
}
/* escape in operator pending cancels the operation */
bindkey(oppmap, "\33", refthingy(t_vicmdmode), NULL);
+ bindkey(vismap, "\33", refthingy(t_deactivateregion), NULL);
bindkey(vismap, "o", refthingy(t_exchangepointandmark), NULL);
bindkey(vismap, "p", refthingy(t_putreplaceselection), NULL);
bindkey(vismap, "x", refthingy(t_videlete), NULL);
diff --git a/Src/Zle/zle_move.c b/Src/Zle/zle_move.c
index d751c43..cf8f345 100644
--- a/Src/Zle/zle_move.c
+++ b/Src/Zle/zle_move.c
@@ -555,6 +555,13 @@ visuallinemode(UNUSED(char **args))
return 0;
}
+/**/
+int
+deactivateregion(UNUSED(char **args))
+{
+ region_active = 0;
+ return 0;
+}
/**/
int
Messages sorted by:
Reverse Date,
Date,
Thread,
Author