summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2014-12-13 19:31:35 +0100
committerOliver Kiddle <opk@zsh.org>2014-12-13 19:32:55 +0100
commit5b7950e6ef6911448a87401345eb72229b54d4e8 (patch)
treefb5ff1cee9319e9fd006aa2e91292069f250a372
parentedb9c94025cebb853142c7e91b88c991ddd21b22 (diff)
downloadzsh-5b7950e6ef6911448a87401345eb72229b54d4e8.tar.gz
zsh-5b7950e6ef6911448a87401345eb72229b54d4e8.tar.xz
zsh-5b7950e6ef6911448a87401345eb72229b54d4e8.zip
33846: additional default vi-mode key bindings
-rw-r--r--ChangeLog5
-rw-r--r--Src/Zle/iwidgets.list6
-rw-r--r--Src/Zle/zle_bindings.c4
-rw-r--r--Src/Zle/zle_keymap.c7
4 files changed, 17 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index cee9f0689..aea367d45 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-13  Oliver Kiddle  <opk@zsh.org>
+
+	* 33846: Src/Zle/iwidgets.list, Src/Zle/zle_bindings.c,
+	Src/Zle/zle_keymap.c: additional default vi-mode key bindings
+
 2014-12-12  Oliver Kiddle  <opk@zsh.org>
 
 	* 33950: Doc/Zsh/zle.yo, Src/Zle/iwidgets.list, Src/Zle/zle.h,
diff --git a/Src/Zle/iwidgets.list b/Src/Zle/iwidgets.list
index 5e598cc79..b41661a7d 100644
--- a/Src/Zle/iwidgets.list
+++ b/Src/Zle/iwidgets.list
@@ -24,7 +24,7 @@
 "backward-kill-word", backwardkillword, ZLE_KILL | ZLE_KEEPSUFFIX
 "backward-word", backwardword, 0
 "beep", handlefeep, 0
-"beginning-of-buffer-or-history", beginningofbufferorhistory, 0
+"beginning-of-buffer-or-history", beginningofbufferorhistory, ZLE_LINEMOVE
 "beginning-of-history", beginningofhistory, 0
 "beginning-of-line", beginningofline, 0
 "beginning-of-line-hist", beginningoflinehist, 0
@@ -46,7 +46,7 @@
 "down-line-or-search", downlineorsearch, ZLE_LINEMOVE | ZLE_LASTCOL
 "emacs-backward-word", emacsbackwardword, 0
 "emacs-forward-word", emacsforwardword, 0
-"end-of-buffer-or-history", endofbufferorhistory, 0
+"end-of-buffer-or-history", endofbufferorhistory, ZLE_LINEMOVE
 "end-of-history", endofhistory, 0
 "end-of-line", endofline, 0
 "end-of-line-hist", endoflinehist, 0
@@ -143,7 +143,7 @@
 "vi-digit-or-beginning-of-line", vidigitorbeginningofline, 0
 "vi-down-line-or-history", vidownlineorhistory, ZLE_LINEMOVE
 "vi-end-of-line", viendofline, ZLE_LASTCOL
-"vi-fetch-history", vifetchhistory, 0
+"vi-fetch-history", vifetchhistory, ZLE_LINEMOVE
 "vi-find-next-char", vifindnextchar, 0
 "vi-find-next-char-skip", vifindnextcharskip, 0
 "vi-find-prev-char", vifindprevchar, 0
diff --git a/Src/Zle/zle_bindings.c b/Src/Zle/zle_bindings.c
index 50a29551d..e3337d032 100644
--- a/Src/Zle/zle_bindings.c
+++ b/Src/Zle/zle_bindings.c
@@ -308,7 +308,7 @@ int vicmdbind[128] = {
     /* ^O */ z_undefinedkey,
     /* ^P */ z_uphistory,
     /* ^Q */ z_undefinedkey,
-    /* ^R */ z_redisplay,
+    /* ^R */ z_redo,
     /* ^S */ z_undefinedkey,
     /* ^T */ z_undefinedkey,
     /* ^U */ z_undefinedkey,
@@ -407,7 +407,7 @@ int vicmdbind[128] = {
     /* r */ z_vireplacechars,
     /* s */ z_visubstitute,
     /* t */ z_vifindnextcharskip,
-    /* u */ z_viundochange,
+    /* u */ z_undo,
     /* v */ z_visualmode,
     /* w */ z_viforwardword,
     /* x */ z_videletechar,
diff --git a/Src/Zle/zle_keymap.c b/Src/Zle/zle_keymap.c
index b703ebee1..afba592a7 100644
--- a/Src/Zle/zle_keymap.c
+++ b/Src/Zle/zle_keymap.c
@@ -1367,6 +1367,13 @@ default_bindings(void)
     bindkey(vismap, "x", refthingy(t_videlete), NULL);
     bindkey(vismap, "~", refthingy(t_vioperswapcase), NULL);
 
+    /* vi mode: some common vim bindings */
+    bindkey(amap, "ga", refthingy(t_whatcursorposition), NULL);
+    bindkey(amap, "ge", refthingy(t_vibackwardwordend), NULL);
+    bindkey(amap, "gE", refthingy(t_vibackwardblankwordend), NULL);
+    bindkey(amap, "gg", refthingy(t_beginningofbufferorhistory), NULL);
+    bindkey(amap, "g~", refthingy(t_vioperswapcase), NULL);
+
     /* emacs mode: arrow keys */ 
     add_cursor_key(emap, TCUPCURSOR, t_uplineorhistory, 'A');
     add_cursor_key(emap, TCDOWNCURSOR, t_downlineorhistory, 'B');