summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2008-06-28 10:08:14 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2008-06-28 10:08:14 +0200
commit8896ac675b5bf513074d7552da7d9f4cf8d16217 (patch)
tree8c126c7993d9148658f9e0dff4033194c88f5ecd /etc
parentb906e284447b1515056b8a763d32fb5f4a78b28b (diff)
now use autoloading for functions
Diffstat (limited to 'etc')
-rw-r--r--etc/completion3
-rw-r--r--etc/function3
-rw-r--r--etc/functions/cdl6
-rw-r--r--etc/functions/chpwd18
-rw-r--r--etc/functions/extr44
-rw-r--r--etc/functions/l20
-rw-r--r--etc/functions/plonkhost4
-rw-r--r--etc/functions/world-readable4
-rw-r--r--etc/rc2
-rw-r--r--etc/variables1
10 files changed, 47 insertions, 58 deletions
diff --git a/etc/completion b/etc/completion
index a0c8dd5..5f900d6 100644
--- a/etc/completion
+++ b/etc/completion
@@ -2,9 +2,6 @@
zstyle :compinstall filename "$HOME/.zshrc"
-# Add own completions
-fpath=($ZDIR/completions $fpath)
-
ls-colors: zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
# Mark the current selection when tabbing through possible completions
diff --git a/etc/function b/etc/function
new file mode 100644
index 0000000..90d709d
--- /dev/null
+++ b/etc/function
@@ -0,0 +1,3 @@
+for i in $ZDIR/functions/*; {
+ autoload $i:t
+}
diff --git a/etc/functions/cdl b/etc/functions/cdl
index 49b4d7f..a23a0f6 100644
--- a/etc/functions/cdl
+++ b/etc/functions/cdl
@@ -1,4 +1,2 @@
-cdl () {
- cd "$1";
- ls;
-}
+cd "$1";
+ls;
diff --git a/etc/functions/chpwd b/etc/functions/chpwd
index 8cfd926..fd8feba 100644
--- a/etc/functions/chpwd
+++ b/etc/functions/chpwd
@@ -1,10 +1,8 @@
-chpwd () {
- pstags=''
- [ -f .todo ] && pstags+='todo '
- [ -f .fehindex.jpg ] && pstags+='feh '
- [ -d .hg ] && pstags+='hg '
- [ -d .git ] && pstags+='git '
- [ -d .svn ] && pstags+='svn '
- [ -f Makefile -o -f makefile ] && pstags+='make '
- source $ZDIR/prompt
-}
+pstags=''
+[ -f .todo ] && pstags+='todo '
+[ -f .fehindex.jpg ] && pstags+='feh '
+[ -d .hg ] && pstags+='hg '
+[ -d .git ] && pstags+='git '
+[ -d .svn ] && pstags+='svn '
+[ -f Makefile -o -f makefile ] && pstags+='make '
+source $ZDIR/prompt
diff --git a/etc/functions/extr b/etc/functions/extr
index 784671b..98d3ffe 100644
--- a/etc/functions/extr
+++ b/etc/functions/extr
@@ -1,24 +1,22 @@
# builtin function for archives, see $ZDIR/alias_suffix
-extr () {
- if [[ -f "$1" ]]; then
- case "$1" in
- *.tar.bz2) tar xjvf "$1" ;;
- *.tar.gz) tar xvzf "$1" ;;
- *.ace) unace e "$1" ;;
- *.rar) unrar x "$1" ;;
- *.deb) ar -x "$1" ;;
- *.bz2) bzip2 -d "$1" ;;
- *.lzh) lha x "$1" ;;
- *.gz) gunzip -d "$1" ;;
- *.tar) tar xvf "$1" ;;
- *.tgz) gunzip -d "$1" ;;
- *.tbz2) tar jxvf "$1" ;;
- *.zip) unzip "$1" ;;
- *.Z) uncompress "$1" ;;
- *.shar) sh "$1" ;;
- *) echo "I don't know the archive type of '"$1"' :(" ;;
- esac
- else
- echo "Hm. Seems '"$1"' is not a valid file."
- fi
-}
+if [[ -f "$1" ]]; then
+ case "$1" in
+ *.tar.bz2) tar xjvf "$1" ;;
+ *.tar.gz) tar xvzf "$1" ;;
+ *.ace) unace e "$1" ;;
+ *.rar) unrar x "$1" ;;
+ *.deb) ar -x "$1" ;;
+ *.bz2) bzip2 -d "$1" ;;
+ *.lzh) lha x "$1" ;;
+ *.gz) gunzip -d "$1" ;;
+ *.tar) tar xvf "$1" ;;
+ *.tgz) gunzip -d "$1" ;;
+ *.tbz2) tar jxvf "$1" ;;
+ *.zip) unzip "$1" ;;
+ *.Z) uncompress "$1" ;;
+ *.shar) sh "$1" ;;
+ *) echo "I don't know the archive type of '"$1"' :(" ;;
+ esac
+else
+ echo "Hm. Seems '"$1"' is not a valid file."
+fi
diff --git a/etc/functions/l b/etc/functions/l
index d461998..c95a299 100644
--- a/etc/functions/l
+++ b/etc/functions/l
@@ -1,12 +1,10 @@
# self-explaining, I think
-l () {
- if [[ -f "$1" ]]; then
- case "$1" in
- *.bz2) bzless "$1" ;;
- *.gz) zless "$1" ;;
- *) less "$1" ;;
- esac
- else
- echo "No such file, dude."
- fi
-}
+if [[ -f "$1" ]]; then
+ case "$1" in
+ *.bz2) bzless "$1" ;;
+ *.gz) zless "$1" ;;
+ *) less "$1" ;;
+ esac
+else
+ echo "No such file, dude."
+fi
diff --git a/etc/functions/plonkhost b/etc/functions/plonkhost
index 3b6cc95..072147a 100644
--- a/etc/functions/plonkhost
+++ b/etc/functions/plonkhost
@@ -1,3 +1 @@
-plonkhost () {
- sudo iptables -I INPUT -s "$1" -j DROP
-}
+sudo iptables -I INPUT -s "$1" -j DROP
diff --git a/etc/functions/world-readable b/etc/functions/world-readable
index c66a479..7963223 100644
--- a/etc/functions/world-readable
+++ b/etc/functions/world-readable
@@ -1,3 +1 @@
-world-readable () {
- chmod -R a+rX .
-}
+chmod -R a+rX .
diff --git a/etc/rc b/etc/rc
index 52546a8..1f86911 100644
--- a/etc/rc
+++ b/etc/rc
@@ -14,7 +14,7 @@ alias 'debian:'='[ -n "$debian" ] &&'
source $ZDIR/modules
source $ZDIR/variables
source $ZDIR/colors
-source $ZDIR/functions/*
+source $ZDIR/function
source $ZDIR/options
source $ZDIR/prompt
source $ZDIR/directories
diff --git a/etc/variables b/etc/variables
index e857bd8..733d1c3 100644
--- a/etc/variables
+++ b/etc/variables
@@ -6,6 +6,7 @@ HISTSIZE=50000
SAVEHIST=$HISTSIZE
DIRSTACKSIZE=20
LISTMAX=0
+fpath=($ZDIR/functions $ZDIR/completions $fpath)
# Paths
[ "$path[1]" = "$HOME/bin" ] || export PATH=$HOME/bin:$PATH