zshrc: Fix `salias' wrt parameter scope
[grml-etc-core.git] / etc / zsh / zshrc
index b046058..795cc37 100644 (file)
@@ -406,6 +406,7 @@ check_com() {
 salias() {
     emulate -L zsh
     local only=0 ; local multi=0
+    local key val
     while [[ $1 == -* ]] ; do
         case $1 in
             (-o) only=1 ;;
@@ -1313,7 +1314,7 @@ zstyle ':completion:hist-complete:*' completer _history
 typeset -ga grml_missing_features
 
 function zrcbindkey() {
-    if (( ARGC && ${+widgets[${argv[-1]}]} )); then
+    if (( ARGC )) && zrcgotwidget ${argv[-1]}; then
         bindkey "$@"
     fi
 }
@@ -1392,6 +1393,7 @@ bind2maps       viins vicmd -- Right  vi-forward-char
 bind2maps       viins vicmd -- Right  vi-forward-char
 
 if zrcgotkeymap menuselect; then
+    #m# k Shift-tab Perform backwards menu completion
     bind2maps menuselect -- BackTab reverse-menu-complete
 
     #k# menu selection: pick item but stay in the menu
@@ -1443,13 +1445,6 @@ zrcbindkey "\e[6~" history-beginning-search-forward-end  # PageDown
 #k# Insert Unicode character
 zrcbindkey '^xi' insert-unicode-char
 
-#m# k Shift-tab Perform backwards menu completion
-if [[ -n "$terminfo[kcbt]" ]]; then
-    zrcbindkey "$terminfo[kcbt]" reverse-menu-complete
-elif [[ -n "$terminfo[cbt]" ]]; then # required for GNU screen
-    zrcbindkey "$terminfo[cbt]"  reverse-menu-complete
-fi
-
 #k# Toggle abbreviation expansion on/off
 zrcbindkey '^xA' grml_toggle_abbrev
 zrcbindkey "^x^h" commit-to-history