]> git.madduck.net Git - etc/zsh.git/blobdiff - .zsh/zshrc/82-load_alias-d

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

convert aliases anonymous functions to proper functions
[etc/zsh.git] / .zsh / zshrc / 82-load_alias-d
index 62e6e39f7df43e0063716bef271fc616148c1983..29880a9d4b7333fb2e730a28ec6a376a3aa7746f 100644 (file)
@@ -12,9 +12,11 @@ function make_alias {
   setopt extendedglob
   local fn="${1:t}" s
   for l in ${(f)"$(<$1)"}; do
+    0=$fn
     case "$s/$l" in
       (*/\#*) continue;;
-      (/*) eval "alias $fn='${l//\$0/$fn}'"; s=s; 0=$fn;;
+      (/\(\)*) eval "function $fn$l"; s=s;;
+      (/*) eval "alias $fn='${l//\$0/$fn}'"; s=s;;
       (s/(#b)(*)) eval "$match[1]";;
     esac
   done