From: martin f. krafft Date: Wed, 17 May 2017 13:16:38 +0000 (+0200) Subject: convert aliases anonymous functions to proper functions X-Git-Url: https://git.madduck.net/etc/zsh.git/commitdiff_plain/f9a91601a570cea7ff13a5f9c1894a8f63fbbae6 convert aliases anonymous functions to proper functions --- diff --git a/.zsh/aliases/rrsh b/.zsh/aliases/rrsh old mode 100644 new mode 100755 index 8fb62d7..ea281ba --- a/.zsh/aliases/rrsh +++ b/.zsh/aliases/rrsh @@ -1 +1,2 @@ -() { ssh "$@" -t /bin/su } +() { ssh "${@:-}" -t /bin/su } +compdef ${0}=ssh diff --git a/.zsh/zshrc/82-load_alias-d b/.zsh/zshrc/82-load_alias-d index 62e6e39..29880a9 100644 --- a/.zsh/zshrc/82-load_alias-d +++ b/.zsh/zshrc/82-load_alias-d @@ -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