summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2008-05-19 19:33:01 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2008-05-19 19:33:01 +0200
commit42562531389e9998c83a1c05a1551244e4457f55 (patch)
tree726751aa9e3eae2e7df7d68fbb813bdca38ef3fa /etc
initial commit
Diffstat (limited to 'etc')
-rw-r--r--etc/alias/default52
-rw-r--r--etc/alias/font10
-rw-r--r--etc/alias/global9
-rw-r--r--etc/alias/short95
-rw-r--r--etc/alias/suffix38
-rw-r--r--etc/colors15
-rw-r--r--etc/completion7
-rw-r--r--etc/dircolors171
-rw-r--r--etc/directories21
-rw-r--r--etc/functions62
-rw-r--r--etc/options17
-rw-r--r--etc/profile2
-rw-r--r--etc/prompt5
-rw-r--r--etc/rc48
14 files changed, 552 insertions, 0 deletions
diff --git a/etc/alias/default b/etc/alias/default
new file mode 100644
index 0000000..3b66907
--- /dev/null
+++ b/etc/alias/default
@@ -0,0 +1,52 @@
+## Some useful default options
+## To evade them, use '=foo' instead of 'foo'
+## vim:ft=zsh
+
+# The free/used/total space of encfs type filesystems is broken here
+[ $uname = Linux ] && alias df='df --human-readable --local --exclude-type=fuse.encfs' || alias df='df -hl'
+
+[ $uname = Linux ] && alias du='du --human-readable --summarize' || alias du='du -sh'
+
+alias feh='feh --quiet'
+
+alias fgrep='grep -F --color=auto'
+
+# find does globbing itself
+alias find='noglob find'
+
+alias grep='grep --color=auto'
+
+alias host='host -a'
+
+# I often use it for just *viewing* things, which works fine without root
+alias ifconfig='/sbin/ifconfig'
+
+# This is an export, so that also man() and other apps using less as pager get it
+# clear-screen = much faster scrolling on ttys
+# RAW-CONTROL-CHARS = Don't produce crap if the file contains ANSI color sequences
+export LESS='--silent --clear-screen --RAW-CONTROL-CHARS --quit-if-one-screen --ignore-case --tabs=5'
+
+# classify = "/" after dirs, "*" after executables etc
+[ $uname = Linux ] && alias ls='ls --color=auto --classify --human-readable' || alias ls='ls -Fh'
+
+# Somehow folllowing the 'learn something new every day' ;-)
+[ $uname = Linux ] && alias man='man --all' || alias man='man -a'
+
+# Useful on sshfs or similar
+alias mplayer='mplayer -cache 6000 -cache-min 50'
+
+alias mv='mv -i'
+
+alias mx='mx -aZ'
+
+# Only TCP/TCP6, not sockets and such
+[ $uname = Linux ] && alias netstat='sudo netstat --program --listening --all --tcp --extend' || alias netstat='sudo netstat -latp tcp'
+
+# BSD style
+alias ps='ps aux'
+
+# use unicode, reattach anyway
+alias screen='screen -DUR'
+
+# Don't collapse trees
+alias todo='todo -f +children'
diff --git a/etc/alias/font b/etc/alias/font
new file mode 100644
index 0000000..a2310f3
--- /dev/null
+++ b/etc/alias/font
@@ -0,0 +1,10 @@
+## Shamelessly stolen from http://git.kitenet.net/?p=joey/home-etc;a=summary
+## vim:ft=zsh
+alias font-tiny='echo -en "\033]50;-misc-fixed-medium-r-normal--8-80-75-75-c-50-iso10646-1\007"'
+alias font-small='echo -en "\033]50;6x10\007"'
+alias font-default='echo -e "\033]50;-misc-fixed-medium-r-semicondensed--13-*-*-*-*-*-iso10646-1\007"'
+alias font-medium='echo -en "\033]50;-misc-fixed-medium-r-normal--13-120-75-75-c-80-iso10646-1\007"'
+alias font-large='echo -en "\033]50;-misc-fixed-medium-*-*-*-15-*-*-*-*-*-iso10646-1\007"'
+alias font-larger='echo -en "\033]50;-misc-fixed-medium-r-normal--18-*-*-*-*-*-iso10646-1\007"'
+alias font-huge='echo -en "\033]50;-misc-fixed-medium-r-normal--20-200-75-75-c-100-iso10646-1\007"'
+
diff --git a/etc/alias/global b/etc/alias/global
new file mode 100644
index 0000000..4398484
--- /dev/null
+++ b/etc/alias/global
@@ -0,0 +1,9 @@
+## Global aliases
+## evil, but rarely messy
+## vim:ft=zsh
+alias -g EG='|egrep'
+alias -g FG='|fgrep'
+alias -g G='|grep'
+alias -g H='|head'
+alias -g L='|less'
+alias -g T='|tail'
diff --git a/etc/alias/short b/etc/alias/short
new file mode 100644
index 0000000..e6c56a3
--- /dev/null
+++ b/etc/alias/short
@@ -0,0 +1,95 @@
+## Short aliases
+## vim:ft=zsh
+
+## Debian package system (aptitude/apt-get, apt-cache, dpkg)
+
+# Search the packages list
+alias acse='apt-cache search'
+alias apse='aptitude search'
+
+# Show package information
+alias acsh='apt-cache show'
+alias apsh='aptitude show'
+alias dps='dpkg --status'
+
+# Update packages list
+alias agu='sudo apt-get update'
+alias apu='sudo aptitude update'
+
+# Update packages
+alias ags='sudo apt-get upgrade'
+alias agf='sudo apt-get dist-upgrade'
+alias aps='sudo aptitude safe-upgrade'
+alias apf='sudo aptitude full-upgrade'
+
+# Install packages
+alias agi='sudo apt-get install'
+alias api='sudo aptitude install'
+alias dpi='sudo dpkg --install'
+
+# Clean packages cache
+alias agc='sudo apt-get clean'
+alias apc='sudo aptitude clean'
+
+# Remove/Purge packages
+alias agp='sudo apt-get purge'
+alias agr='sudo apt-get remove'
+alias dpp='sudo dpkg --purge'
+alias dpr='sudo dpkg --remove'
+
+# Configure packages
+alias dprc='sudo dpkg-reconfigure'
+
+
+alias acp='apt-cache policy'
+
+## feh
+alias fehf='feh -Tfull' # Fullscreen
+alias fehi='feh .fehindex.jpg'
+alias fehj='feh -Tjust' # Screensaver-like
+for i in {5,10,15,20}; {
+ alias fehj$i='feh -Tjust'$i
+ alias fehf$i='feh -Tfull'$i
+}
+alias fehjx='feh -Tjust --slideshow-delay'
+alias fehfx='feh -Tjust --slideshow-delay'
+alias feht='feh -Tthumbnail' # List thumbnails
+
+## Mercurial (hg)
+alias hga='hg add'
+alias hgc='hg commit -m'
+alias hgd='hg diff | less'
+alias hgf='hg fetch'
+alias hgg='hg glog | less'
+alias hgh='hg heads'
+alias hgi='hg incoming'
+alias hgl='hg log | less'
+alias hgm='hg merge'
+alias hgp='hg push'
+alias hgrm='hg remove'
+alias hgrv='hg revert'
+alias hgs='hg status'
+alias hgu='hg update'
+alias hgv='hg verify'
+
+# List archive files
+alias lsb='tar tvjf'
+alias lst='tar tvf'
+alias lsz='tar tvzf'
+
+# Automatically upload screenshot plzkthx
+alias putscreen='FILE=$(screenshot); put $FILE; unset FILE'
+
+# Useful when a beamer is connected to my laptop
+alias rplayer='mplayer -vo x11 -zoom -vf scale=1024:-2'
+
+## Suspend
+alias s2d='sudo s2disk'
+alias s2r='sudo s2ram -f'
+
+## Snownews
+alias sn='snownews'
+alias snu='snownews -u'
+
+# start x and log out immediately
+alias x='startx &! exit'
diff --git a/etc/alias/suffix b/etc/alias/suffix
new file mode 100644
index 0000000..30c96c8
--- /dev/null
+++ b/etc/alias/suffix
@@ -0,0 +1,38 @@
+## Sufix aliases
+## Like, enter "somefile.ogg" and zsh will automatically open it using $audio_app
+## vim:ft=zsh
+# part 1: what filetypes to open whith what app?
+# List of filetypes covered by aliases
+filetypes=(archive audio midi video image document raw office emul)
+
+# Formats
+archive_formats=(tar.bz2 tar.gz tar bz2 gz zip rar)
+audio_formats=(flac mp3 ogg wav wma)
+midi_formats=(mid s3m)
+video_formats=(avi divx flv m4v mkv mp4 mpg mpeg ogm wmv)
+image_formats=(bmp jpg jpeg gif png)
+document_formats=(pdf ps)
+raw_formats=(conf ini log txt htm html xhtml c cpp lst)
+office_formats=(doc odt ott rtf sxw)
+emul_formats=(exe)
+
+# Applications
+archive_app='extr'
+audio_app='mplayer'
+video_app='mplayer'
+midi_app='timidity'
+image_app='feh -Tfull'
+document_app='kpdf'
+raw_app='vim'
+office_app='openoffice'
+emul_app='wine'
+
+# part 2: create the aliases
+for meta in $filetypes; do
+ for format in $(eval echo -n "$"${meta}_formats); do
+ eval alias -s $format="$"${meta}_app
+ done
+ unset ${meta}_{formats,app}
+done
+
+unset filetypes meta
diff --git a/etc/colors b/etc/colors
new file mode 100644
index 0000000..6b72bca
--- /dev/null
+++ b/etc/colors
@@ -0,0 +1,15 @@
+## Colors
+## vim:ft=zsh
+local fail=$'\e[1;31m'
+local info=$'\e[0;36m'
+local yellow=$'\e[0;33m'
+local green=$'\e[0;32m'
+local red=$'\e[0;31m'
+local reset=$'\e[0m'
+
+local ps_fail="%{$fail%}"
+local ps_info="%{$info%}"
+local ps_yellow="%{$yellow%}"
+local ps_green="%{$green%}"
+local ps_red="%{$red%}"
+local ps_reset="%{$reset%}"
diff --git a/etc/completion b/etc/completion
new file mode 100644
index 0000000..a31d682
--- /dev/null
+++ b/etc/completion
@@ -0,0 +1,7 @@
+## vim:ft=zsh
+
+zstyle ':completion:*' list-colors $(dircolors $HOME/packages/zsh/etc/dircolors | head -n 1 | sed -r 's/LS_COLORS=|;$//g')
+# Mark the current selection when tabbing through possible completions
+zstyle ':completion:*' menu select=1
+# Also complete uppercase names with lowercase
+zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' ''
diff --git a/etc/dircolors b/etc/dircolors
new file mode 100644
index 0000000..41ed69b
--- /dev/null
+++ b/etc/dircolors
@@ -0,0 +1,171 @@
+# Configuration file for dircolors, a utility to help you set the
+# LS_COLORS environment variable used by GNU ls with the --color option.
+# Copyright (C) 1996, 1999-2008
+# Free Software Foundation, Inc.
+# Copying and distribution of this file, with or without modification,
+# are permitted provided the copyright notice and this notice are preserved.
+# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the
+# slackware version of dircolors) are recognized but ignored.
+# Below, there should be one TERM entry for each termtype that is colorizable
+TERM Eterm
+TERM ansi
+TERM color-xterm
+TERM con132x25
+TERM con132x30
+TERM con132x43
+TERM con132x60
+TERM con80x25
+TERM con80x28
+TERM con80x30
+TERM con80x43
+TERM con80x50
+TERM con80x60
+TERM cons25
+TERM console
+TERM cygwin
+TERM dtterm
+TERM eterm-color
+TERM gnome
+TERM gnome-256color
+TERM konsole
+TERM kterm
+TERM linux
+TERM linux-c
+TERM mach-color
+TERM mlterm
+TERM putty
+TERM rxvt
+TERM rxvt-cygwin
+TERM rxvt-cygwin-native
+TERM rxvt-unicode
+TERM screen
+TERM screen-256color
+TERM screen-bce
+TERM screen-w
+TERM screen.linux
+TERM vt100
+TERM xterm
+TERM xterm-16color
+TERM xterm-256color
+TERM xterm-88color
+TERM xterm-color
+TERM xterm-debian
+# Below are the color init strings for the basic file types. A color init
+# string consists of one or more of the following numeric codes:
+# Attribute codes:
+# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
+# Text color codes:
+# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
+# Background color codes:
+# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
+NORMAL 00 # global default, although everything should be something.
+FILE 00 # normal file
+DIR 01;37 # directory
+LINK 01;36 # symbolic link. (If you set this to 'target' instead of a
+ # numerical value, the color is as for the file pointed to.)
+FIFO 40;33 # pipe
+SOCK 01;35 # socket
+DOOR 01;35 # door
+BLK 40;33;01 # block device driver
+CHR 40;33;01 # character device driver
+ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file
+SETUID 37;41 # file that is setuid (u+s)
+SETGID 30;43 # file that is setgid (g+s)
+STICKY_OTHER_WRITABLE 30;42 # dir that is sticky and other-writable (+t,o+w)
+OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky
+STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable
+# This is for files with execute permission:
+EXEC 01;32
+# List any file extensions like '.gz' or '.tar' that you would like ls
+# to colorize below. Put the extension, a space, and the color init string.
+# (and any comments you want to add after a '#')
+# If you use DOS-style suffixes, you may want to uncomment the following:
+#.cmd 01;32 # executables (bright green)
+#.exe 01;32
+#.com 01;32
+#.btm 01;32
+#.bat 01;32
+# Or if you want to colorize scripts even if they do not have the
+# executable bit actually set.
+#.sh 01;32
+#.csh 01;32
+ # archives or compressed (bright red)
+.tar 04;31
+.tgz 04;31
+.svgz 04;31
+.arj 04;31
+.taz 04;31
+.lzh 04;31
+.lzma 04;31
+.zip 04;31
+.z 04;31
+.Z 04;31
+.dz 04;31
+.gz 04;31
+.bz2 04;31
+.bz 04;31
+.tbz2 04;31
+.tz 04;31
+.deb 04;31
+.rpm 04;31
+.jar 04;31
+.rar 04;31
+.ace 04;31
+.zoo 04;31
+.cpio 04;31
+.7z 04;31
+.rz 04;31
+# image formats
+.jpg 04;33
+.jpeg 04;33
+.gif 04;33
+.bmp 04;33
+.pbm 04;33
+.pgm 04;33
+.ppm 04;33
+.tga 04;33
+.xbm 04;33
+.xpm 04;33
+.tif 04;33
+.tiff 04;33
+.png 04;33
+.svg 04;33
+.mng 04;33
+.pcx 04;33
+.mov 04;33
+.mpg 04;32
+.mpeg 04;32
+.m2v 04;32
+.mkv 04;32
+.ogm 04;32
+.mp4 04;32
+.m4v 04;32
+.mp4v 04;32
+.vob 04;32
+.qt 04;32
+.nuv 04;32
+.wmv 04;32
+.asf 04;32
+.rm 04;32
+.rmvb 04;32
+.flc 04;32
+.avi 04;32
+.divx 04;32
+.fli 04;32
+.gl 04;32
+.dl 04;32
+.xcf 04;32
+.xwd 04;32
+.yuv 04;32
+# audio formats
+.aac 04;36
+.au 04;36
+.flac 04;36
+.mid 04;36
+.midi 04;36
+.mka 04;36
+.mp3 04;36
+.mpc 04;36
+.ogg 04;36
+.ra 04;36
+.wav 04;36
diff --git a/etc/directories b/etc/directories
new file mode 100644
index 0000000..28ac63c
--- /dev/null
+++ b/etc/directories
@@ -0,0 +1,21 @@
+## Named directories
+## vim:ft=zsh
+case `hostname` in
+ kraftwerk)
+ music=/data/share/music
+ www=/data/www
+ web=$HOME/public_html
+ export lyrics=/data/wildernet/lyrics
+ export vcs=/data/derf/svn
+ ;;
+ saviour)
+ music=$HOME/audio
+ www=/var/www
+ cgi=/usr/lib/cgi-bin
+ export lyrics=$HOME/var/svn/lyrics
+ export vcs=$HOME/var/svn
+ ;;
+ nemesis)
+ export vcs=$HOME/var/svn
+ export lyrics=$vcs/lyrics
+esac
diff --git a/etc/functions b/etc/functions
new file mode 100644
index 0000000..4a7c82c
--- /dev/null
+++ b/etc/functions
@@ -0,0 +1,62 @@
+## 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 '
+ source $ZDIR/prompt
+}
+
+plonkhost () {
+ sudo iptables -I INPUT -s "$1" -j DROP
+}
diff --git a/etc/options b/etc/options
new file mode 100644
index 0000000..4e4f636
--- /dev/null
+++ b/etc/options
@@ -0,0 +1,17 @@
+## Some useful options, see zshoptions(1)
+## vim:ft=zsh
+# Automatically use 'pushd' when cd'ing into a directory
+# so I can use popd or 'cd -1' to get back where I came from.
+# And don't print the stack everytime using popd.
+setopt auto_pushd pushd_ignore_dups pushd_minus pushd_silent
+# enter "foobar/" to cd foobar, and "derf" to cd ~derf
+setopt auto_cd cdable_vars
+# Try to correct typos in command names
+setopt correct
+# echo 'foo''bar''' will become foo'bar'
+setopt rc_quotes
+# Accidently hitting ^s sucks (alternative: `stty -ixon`)
+unsetopt flow_control
+# And having to escape "!" everytime does, too
+unsetopt bang_hist
+unsetopt beep
diff --git a/etc/profile b/etc/profile
new file mode 100644
index 0000000..34ab4ff
--- /dev/null
+++ b/etc/profile
@@ -0,0 +1,2 @@
+source $HOME/etc/zsh/colors
+print -P "${info}>>${reset} this is ${info}`uname -srm`${reset} on ${info}%l${reset}"
diff --git a/etc/prompt b/etc/prompt
new file mode 100644
index 0000000..43db236
--- /dev/null
+++ b/etc/prompt
@@ -0,0 +1,5 @@
+## Prompt
+## vim:ft=zsh
+# RPS1 is on the right side of the terminal
+export PS1="${ps_yellow}%n@%m${ps_reset} %c %(!.${ps_red}#.${ps_green}%%)${ps_reset} "
+export RPS1="${ps_yellow}[${ps_info}${pstags}${ps_yellow}%T]${ps_reset}"
diff --git a/etc/rc b/etc/rc
new file mode 100644
index 0000000..aa2f4d5
--- /dev/null
+++ b/etc/rc
@@ -0,0 +1,48 @@
+## vim:ft=zsh
+autoload -Uz compinit
+autoload colors
+autoload zargs
+compinit -C
+colors
+
+bindkey -e # EMACS bindings
+zstyle :compinstall filename "$HOME/.zshrc"
+
+## zsh vars
+HISTFILE=~/.histfile
+HISTSIZE=10000
+SAVEHIST=$HISTSIZE
+DIRSTACKSIZE=20
+ZDIR=$HOME/packages/zsh/etc
+uname=$(uname)
+
+## other vars
+export PATH=$HOME/bin:$PATH
+export EDITOR==vim
+export MPD_HOST=saviour
+[ $uname = OpenBSD ] && export PKG_PATH="ftp://ftp.freenet.de/pub/ftp.openbsd.org/pub/OpenBSD/`uname -r`/packages/`machine -a`/:ftp://openbsd.ftp.fu-berlin.de/pub/OpenBSD/`uname -r`/packages/`machine -a`/"
+export HOST
+
+# Fancy directory colors
+[ $uname = Linux ] && eval $(dircolors -b $HOME/packages/zsh/etc/dircolors)
+
+## Host completion
+_hosts() { compadd alpha beta gamma kraftwerk delta epsilon zeta eta saviour theta iota kappa nemesis lambda;}
+
+## Show exitcode on failure
+trap 'echo zsh: Program terminated with exit status $?' ZERR
+
+source $ZDIR/colors
+source $ZDIR/functions
+source $ZDIR/options
+source $ZDIR/prompt
+source $ZDIR/directories
+source $ZDIR/alias/suffix
+source $ZDIR/alias/font
+source $ZDIR/alias/default
+source $ZDIR/alias/global
+source $ZDIR/alias/short
+source $ZDIR/completion
+
+mesg n
+umask 077