changeset 0:8b245298349a

zsh environment - initial import
author Dirk Olmes <dirk@xanthippe.ping.de>
date Mon, 28 Nov 2011 12:36:49 +0100
parents
children e12c50e8ea8c
files oh-my-zsh zshrc zshrc-cassiopeia zshrc-gentoo zshrc-jdk zshrc-linux-gnu zshrc-maven
diffstat 7 files changed, 213 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/oh-my-zsh	Mon Nov 28 12:36:49 2011 +0100
@@ -0,0 +1,32 @@
+# Path to your oh-my-zsh configuration.
+ZSH=$HOME/.oh-my-zsh
+
+# Set name of the theme to load.
+# Look in ~/.oh-my-zsh/themes/
+# Optionally, if you set this to "random", it'll load a random theme each
+# time that oh-my-zsh is loaded.
+#ZSH_THEME="robbyrussell"
+#ZSH_THEME="random"
+
+# Set to this to use case-sensitive completion
+# CASE_SENSITIVE="true"
+
+# Comment this out to disable weekly auto-update checks
+# DISABLE_AUTO_UPDATE="true"
+
+# Uncomment following line if you want to disable colors in ls
+DISABLE_LS_COLORS="true"
+
+# Uncomment following line if you want to disable autosetting terminal title.
+DISABLE_AUTO_TITLE="true"
+
+# Uncomment following line if you want red dots to be displayed while waiting for completion
+# COMPLETION_WAITING_DOTS="true"
+
+# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
+# Example format: plugins=(rails git textmate ruby lighthouse)
+plugins=(git mercurial python svn)
+
+source $ZSH/oh-my-zsh.sh
+
+# Customize to your needs...
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zshrc	Mon Nov 28 12:36:49 2011 +0100
@@ -0,0 +1,51 @@
+#
+# This is the main zshrc file.
+#
+
+if [ -d $HOME/.oh-my-zsh ]; then
+    . $HOME/.zsh-env/oh-my-zsh
+fi
+
+# get rid of some unwanted aliases from the oh-my-zsh env
+unalias l
+unalias lsa
+
+# custom function that should work on all platforms
+cd() { builtin cd "$@"; print -D $PWD; }
+ff() { find $2 -print0 | xargs -0 grep $1 }
+hgrep() { history | grep $* }
+mcd() { mkdir $1; cd $1 }
+psg() { ps auxww | grep -v grep | grep -i "$@" }
+
+# utility function that is used by various other modules
+removeFromPath() {
+    search_term="$1"
+    split_path=(${(s/:/)PATH})
+    clean_path=""
+    for element in ${split_path}
+    do
+        if [[ "${element}" =~ "${search_term}" ]]; then
+            continue
+        fi
+
+        if [ ${#clean_path} -eq 0 ]; then
+            clean_path="${element}"
+        else
+            clean_path="${clean_path}:${element}"
+        fi
+    done
+    echo "${clean_path}"
+}
+
+# include a zshrc per OS type
+local os_zshrc=$HOME/.zsh-env/zshrc-$OSTYPE
+if [ -f ${os_zshrc} ]; then
+    . ${os_zshrc}
+fi
+
+# include a zshrc per host
+local hostname=`uname -n`
+local host_zshrc=$HOME/.zsh-env/zshrc-${hostname}
+if [ -r ${host_zshrc} ]; then
+    . ${host_zshrc}
+fi
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zshrc-cassiopeia	Mon Nov 28 12:36:49 2011 +0100
@@ -0,0 +1,23 @@
+#
+# zshrc for cassiopeia
+#
+
+. $HOME/.zsh-env/zshrc-jdk
+. $HOME/.zsh-env/zshrc-maven
+
+#
+# aliases
+#
+alias bzip=pbzip2
+alias cvscheck='sh -c "cvs -n update 2>&1 | grep \?"'
+alias cvsupdate='cvs -q -z3 update -dP | egrep -v "^\?.*\.d"'
+alias df="df -h"
+alias env="env | sort | $PAGER"
+alias host=hostx
+alias top=htop
+
+#
+# functions to be used directly from the command line
+#
+cvsrm() { rm "$@"; cvs remove "$@" }
+ed() { kate -u "$@" > /dev/null 2>&1 & }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zshrc-gentoo	Mon Nov 28 12:36:49 2011 +0100
@@ -0,0 +1,28 @@
+#
+# zshrc-gentoo: gentoo specific initialization
+#
+
+# keychain setup: authenticate to remote hosts only once
+local hostname=`uname -n`
+local keychain_init_file=$HOME/.keychain/${hostname}-sh
+if [ -r ${keychain_init_file} ]; then
+    . ${keychain_init_file}
+fi
+
+# custom environment variables
+export EDITOR=/usr/bin/nano
+export PATH="${PATH}":/opt/bin
+
+# custom aliases for gentoo
+alias es="ionice -c3 emerge --sync"
+alias wu="emerge -uvDa world"
+
+# custom functions for gentoo
+kcs() { source $HOME/.keychain/`uname -n`-sh }
+
+unalias ll
+ll() { /usr/bin/env -u LC_ALL LANG=C ls -laFh "$@" | more }
+
+lr() { /usr/bin/env -u LC_ALL LANG=C ls -rtlh "$@" }
+# TODO: completion from /etc/init.d
+svc() { /etc/init.d/"$@" }
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zshrc-jdk	Mon Nov 28 12:36:49 2011 +0100
@@ -0,0 +1,37 @@
+#
+# zshrc for handling different Maven versions
+#
+
+switchJdk() {
+    local jdkName="$1"
+    local new_path=`removeFromPath "jdk"`
+    export JAVA_HOME=`/usr/bin/java-config-2 --select-vm=${jdkName} -O`
+    export JAVAC=${JAVA_HOME}/bin/javac
+    export JDK_HOME=${JAVA_HOME}
+    export PATH="${JAVA_HOME}/bin":"${new_path}"
+    java -version
+}
+
+ibmJdk5() {
+    switchJdk "ibm-jdk-bin-1.5"
+}
+
+ibmJdk6() {
+    switchJdk "ibm-jdk-bin-1.6"
+}
+
+jdk14() {
+    switchJdk "sun-jdk-1.4"
+}
+
+jdk5() {
+    switchJdk "sun-jdk-1.5"
+}
+
+jdk6() {
+    switchJdk "sun-jdk-1.6"
+}
+
+jdk7() {
+    switchJdk "oracle-jdk-bin-1.7"
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zshrc-linux-gnu	Mon Nov 28 12:36:49 2011 +0100
@@ -0,0 +1,19 @@
+#
+# zshrc-linux-gnu: zsh env for various linux distributions
+#
+
+# custom environment variables
+export LESS="-X"
+PROMPT="%m%# "
+
+# try to guess the distribution and include a special script for that
+local linux_distro="unknown"
+if [ -d /usr/portage ]; then
+    linux_distro="gentoo"
+fi
+
+# now source the distro zshrc file if it exists
+local distro_zshrc=$HOME/.zsh-env/zshrc-${linux_distro}
+if [ -r "${distro_zshrc}" ]; then
+    . ${distro_zshrc}
+fi
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/zshrc-maven	Mon Nov 28 12:36:49 2011 +0100
@@ -0,0 +1,23 @@
+#
+# zshrc for Maven
+#
+
+switchMaven() {
+    local maven_version="$1"
+    local new_path=`removeFromPath "maven"`
+    export M2_HOME=/usr/share/maven-bin-${maven_version}
+    export PATH="${M2_HOME}/bin":"${new_path}"
+    mvn --version
+}
+
+mvn20() {
+    switchMaven "2.0"
+}
+
+mvn22() {
+    switchMaven "2.2"
+}
+
+mvn30() {
+    switchMaven "3.0"
+}