diff options
Diffstat (limited to 'etc/functions')
-rw-r--r-- | etc/functions | 63 | ||||
-rw-r--r-- | etc/functions/cdl | 4 | ||||
-rw-r--r-- | etc/functions/chpwd | 10 | ||||
-rw-r--r-- | etc/functions/extr | 24 | ||||
-rw-r--r-- | etc/functions/l | 12 | ||||
-rw-r--r-- | etc/functions/plonkhost | 3 | ||||
-rw-r--r-- | etc/functions/world-readable | 3 |
7 files changed, 56 insertions, 63 deletions
diff --git a/etc/functions b/etc/functions deleted file mode 100644 index 113560f..0000000 --- a/etc/functions +++ /dev/null @@ -1,63 +0,0 @@ -## Functions -## vim:ft=zsh -# 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 -} - -# 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 -} - -cdl () { - cd "$1"; - ls; -} - -world-readable () { - chmod -R a+rX . -} - -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 -} - -plonkhost () { - sudo iptables -I INPUT -s "$1" -j DROP -} diff --git a/etc/functions/cdl b/etc/functions/cdl new file mode 100644 index 0000000..49b4d7f --- /dev/null +++ b/etc/functions/cdl @@ -0,0 +1,4 @@ +cdl () { + cd "$1"; + ls; +} diff --git a/etc/functions/chpwd b/etc/functions/chpwd new file mode 100644 index 0000000..8cfd926 --- /dev/null +++ b/etc/functions/chpwd @@ -0,0 +1,10 @@ +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 +} diff --git a/etc/functions/extr b/etc/functions/extr new file mode 100644 index 0000000..784671b --- /dev/null +++ b/etc/functions/extr @@ -0,0 +1,24 @@ +# 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 +} diff --git a/etc/functions/l b/etc/functions/l new file mode 100644 index 0000000..d461998 --- /dev/null +++ b/etc/functions/l @@ -0,0 +1,12 @@ +# 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 +} diff --git a/etc/functions/plonkhost b/etc/functions/plonkhost new file mode 100644 index 0000000..3b6cc95 --- /dev/null +++ b/etc/functions/plonkhost @@ -0,0 +1,3 @@ +plonkhost () { + sudo iptables -I INPUT -s "$1" -j DROP +} diff --git a/etc/functions/world-readable b/etc/functions/world-readable new file mode 100644 index 0000000..c66a479 --- /dev/null +++ b/etc/functions/world-readable @@ -0,0 +1,3 @@ +world-readable () { + chmod -R a+rX . +} |