Apply second patch from issue350
[grml-etc-core.git] / etc / zsh / zshrc
index 7ca68cf..23d288b 100644 (file)
@@ -116,10 +116,10 @@ check_com() {
         return 1
     fi
 
-    if   [[ -n ${commands[$1]}  ]] \
-      || [[ -n ${functions[$1]} ]] \
-      || [[ -n ${aliases[$1]}   ]] \
-      || [[ -n ${reswords[$1]}  ]] ; then
+    if   [[ -n ${commands[$1]}    ]] \
+      || [[ -n ${functions[$1]}   ]] \
+      || [[ -n ${aliases[$1]}     ]] \
+      || [[ -n ${reswords[(r)$1]} ]] ; then
 
         return 0
     fi
@@ -412,6 +412,17 @@ bindkey '^Xi' insert-unicode-char
 #  bindkey . rationalise-dot
 
 #  bindkey '\eq' push-line-or-edit
+
+# use the vi navigation keys (hjkl) besides cursor keys in menu completion
+  bindkey -M menuselect 'h' vi-backward-char                # left
+  bindkey -M menuselect 'k' vi-up-line-or-history           # up
+  bindkey -M menuselect 'l' vi-forward-char                 # right
+  bindkey -M menuselect 'j' vi-down-line-or-history         # bottom
+
+# accept a completion and try to complete again by using menu
+# completion; very useful with completing directories
+# by using 'undo' one's got a simple file browser
+  bindkey -M menuselect '^o' accept-and-infer-next-history
 # }}}
 
 # power completion - abbreviation expansion {{{