From f9a91601a570cea7ff13a5f9c1894a8f63fbbae6 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Wed, 17 May 2017 15:16:38 +0200 Subject: [PATCH 1/1] convert aliases anonymous functions to proper functions --- .zsh/aliases/rrsh | 3 ++- .zsh/zshrc/82-load_alias-d | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) mode change 100644 => 100755 .zsh/aliases/rrsh 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 -- 2.39.5