summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Doc/Zsh/zle.yo7
-rw-r--r--Src/Zle/iwidgets.list12
-rw-r--r--Src/Zle/zle.h11
-rw-r--r--Src/Zle/zle_keymap.c8
5 files changed, 31 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index e30324894..cee9f0689 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-12 Oliver Kiddle <opk@zsh.org>
+
+ * 33950: Doc/Zsh/zle.yo, Src/Zle/iwidgets.list, Src/Zle/zle.h,
+ Src/Zle/zle_keymap.c: ignore KEYTIMEOUT for vi operators
+
2014-12-11 Peter Stephenson <p.stephenson@samsung.com>
* 33876: etc.: Completion/Base/Core/_main_complete,
diff --git a/Doc/Zsh/zle.yo b/Doc/Zsh/zle.yo
index f95264232..d49c72020 100644
--- a/Doc/Zsh/zle.yo
+++ b/Doc/Zsh/zle.yo
@@ -1605,6 +1605,13 @@ Read a movement command from the keyboard, and kill
from the cursor position to the endpoint of the movement.
Then enter insert mode.
If the command is tt(vi-change), change the current line.
+
+For compatibility with vi, if the command is tt(vi-forward-word)
+or tt(vi-forward-blank-word), the whitespace after the word is not
+included. If you prefer the more consistent behaviour with the
+whitespace included use the following key binding:
+
+example(bindkey -a -s cw dwi)
)
tindex(vi-change-eol)
item(tt(vi-change-eol) (unbound) (C) (unbound))(
diff --git a/Src/Zle/iwidgets.list b/Src/Zle/iwidgets.list
index 40750221e..5e598cc79 100644
--- a/Src/Zle/iwidgets.list
+++ b/Src/Zle/iwidgets.list
@@ -134,11 +134,11 @@
"vi-backward-blank-word-end", vibackwardblankwordend, 0
"vi-beginning-of-line", vibeginningofline, 0
"vi-caps-lock-panic", vicapslockpanic, ZLE_LASTCOL
-"vi-change", vichange, ZLE_LASTCOL
+"vi-change", vichange, ZLE_LASTCOL | ZLE_VIOPER
"vi-change-eol", vichangeeol, 0
"vi-change-whole-line", vichangewholeline, 0
"vi-cmd-mode", vicmdmode, 0
-"vi-delete", videlete, ZLE_KEEPSUFFIX | ZLE_LASTCOL
+"vi-delete", videlete, ZLE_KEEPSUFFIX | ZLE_LASTCOL | ZLE_VIOPER
"vi-delete-char", videletechar, ZLE_KEEPSUFFIX
"vi-digit-or-beginning-of-line", vidigitorbeginningofline, 0
"vi-down-line-or-history", vidownlineorhistory, ZLE_LINEMOVE
@@ -159,7 +159,7 @@
"vi-goto-mark-line", vigotomarkline, ZLE_LINEMOVE
"vi-history-search-backward", vihistorysearchbackward, 0
"vi-history-search-forward", vihistorysearchforward, 0
-"vi-indent", viindent, ZLE_LASTCOL
+"vi-indent", viindent, ZLE_LASTCOL | ZLE_VIOPER
"vi-insert", viinsert, 0
"vi-insert-bol", viinsertbol, 0
"vi-join", vijoin, 0
@@ -168,7 +168,7 @@
"vi-match-bracket", vimatchbracket, 0
"vi-open-line-above", viopenlineabove, 0
"vi-open-line-below", viopenlinebelow, 0
-"vi-oper-swap-case", vioperswapcase, ZLE_LASTCOL
+"vi-oper-swap-case", vioperswapcase, ZLE_LASTCOL | ZLE_VIOPER
"vi-pound-insert", vipoundinsert, 0
"vi-put-after", viputafter, ZLE_YANKAFTER | ZLE_KEEPSUFFIX
"vi-put-before", viputbefore, ZLE_YANKBEFORE | ZLE_KEEPSUFFIX
@@ -185,9 +185,9 @@
"vi-substitute", visubstitute, 0
"vi-swap-case", viswapcase, ZLE_LASTCOL
"vi-undo-change", viundochange, ZLE_KEEPSUFFIX
-"vi-unindent", viunindent, ZLE_LASTCOL
+"vi-unindent", viunindent, ZLE_LASTCOL | ZLE_VIOPER
"vi-up-line-or-history", viuplineorhistory, ZLE_LINEMOVE
-"vi-yank", viyank, ZLE_LASTCOL
+"vi-yank", viyank, ZLE_LASTCOL | ZLE_VIOPER
"vi-yank-eol", viyankeol, 0
"vi-yank-whole-line", viyankwholeline, 0
"visual-line-mode", visuallinemode, ZLE_MENUCMP | ZLE_LASTCOL
diff --git a/Src/Zle/zle.h b/Src/Zle/zle.h
index a46b52ded..3c652909e 100644
--- a/Src/Zle/zle.h
+++ b/Src/Zle/zle.h
@@ -207,11 +207,12 @@ struct widget {
#define ZLE_YANKBEFORE (1<<4)
#define ZLE_YANK (ZLE_YANKAFTER | ZLE_YANKBEFORE)
#define ZLE_LINEMOVE (1<<5) /* command is a line-oriented movement */
-#define ZLE_LASTCOL (1<<6) /* command maintains lastcol correctly */
-#define ZLE_KILL (1<<7)
-#define ZLE_KEEPSUFFIX (1<<8) /* DON'T remove added suffix */
-#define ZLE_NOTCOMMAND (1<<9) /* widget should not alter lastcmd */
-#define ZLE_ISCOMP (1<<10) /* usable for new style completion */
+#define ZLE_VIOPER (1<<6) /* widget reads further keys so wait if prefix */
+#define ZLE_LASTCOL (1<<7) /* command maintains lastcol correctly */
+#define ZLE_KILL (1<<8)
+#define ZLE_KEEPSUFFIX (1<<9) /* DON'T remove added suffix */
+#define ZLE_NOTCOMMAND (1<<10) /* widget should not alter lastcmd */
+#define ZLE_ISCOMP (1<<11) /* usable for new style completion */
/* thingies */
diff --git a/Src/Zle/zle_keymap.c b/Src/Zle/zle_keymap.c
index 48f210c7e..b703ebee1 100644
--- a/Src/Zle/zle_keymap.c
+++ b/Src/Zle/zle_keymap.c
@@ -1444,6 +1444,7 @@ getkeymapcmd(Keymap km, Thingy *funcp, char **strp)
Thingy func = t_undefinedkey;
char *str = NULL;
int lastlen = 0, lastc = lastchar;
+ int timeout = 0;
keybuflen = 0;
keybuf[0] = 0;
@@ -1461,7 +1462,7 @@ getkeymapcmd(Keymap km, Thingy *funcp, char **strp)
* argument to bindkey is in the correct form for the locale.
* That's beyond our control.
*/
- while(getkeybuf(!!lastlen) != EOF) {
+ while(getkeybuf(timeout) != EOF) {
char *s;
Thingy f;
int loc = !!localkeymap;
@@ -1480,6 +1481,11 @@ getkeymapcmd(Keymap km, Thingy *funcp, char **strp)
func = f;
str = s;
lastc = lastchar;
+
+ /* can be patient with vi commands that need a motion operator: *
+ * they wait till a key is pressed for the movement anyway */
+ timeout = !(!virangeflag && !region_active && f && f->widget &&
+ f->widget->flags & ZLE_VIOPER);
}
if (!ispfx)
break;