summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--etc/function1
-rwxr-xr-xetc/functions/xsource16
-rw-r--r--etc/rc1
3 files changed, 11 insertions, 7 deletions
diff --git a/etc/function b/etc/function
index 7f4cbb7..4e13745 100644
--- a/etc/function
+++ b/etc/function
@@ -12,6 +12,7 @@ for funcfile in $ZDIR/functions/*(*N);
unset funcfile
colors
+xsource
# from https://git.tabularazor.org/~mikael/etc/tree/zsh/functions
for action in Start Stop Restart Reload; {
diff --git a/etc/functions/xsource b/etc/functions/xsource
index b5cd904..a892d36 100755
--- a/etc/functions/xsource
+++ b/etc/functions/xsource
@@ -2,11 +2,15 @@
# Since source in a function makes typeset'ed parameters local
# (which is not what we want), we use a combination of functions
# and aliases here:
-# autoload xsource; alias x_source='source $xsource_files; unset xsource_files'
+# autoload xsource; xsource
# xsource file anotherfile && x_source
-typeset file
-(( ${#*} )) && unset xsource_files
-for file in $*; {
- [[ -r $file ]] && xsource_files=($xsource_files $file)
+xsource() {
+ typeset file
+ (( ${#*} )) && unset xsource_files
+ for file in $*; {
+ [[ -r $file ]] && xsource_files=($xsource_files $file)
+ }
+ (( ${#xsource_files} )) || return 1
}
-(( ${#xsource_files} )) || return 1
+
+alias x_source='source $xsource_files; unset xsource_files'
diff --git a/etc/rc b/etc/rc
index aac5cfa..0231712 100644
--- a/etc/rc
+++ b/etc/rc
@@ -10,7 +10,6 @@
uname=$(uname)
alias 'linux:'='[[ $uname = Linux ]] &&'
alias 'openbsd:'='[[ $uname = OpenBSD ]] &&'
-alias x_source='source $xsource_files; unset xsource_files'
## include the actual config
source $ZDIR/options