# history

HISTFILE=~/.zsh_history
HISTSIZE=5000
SAVEHIST=1000
setopt appendhistory autocd extendedglob
setopt EXTENDED_HISTORY # puts timestamps in the history
BLACK=”%{“

33[01;30m'"%}"

GREEN="%{"

33[01;32m'"%}"

RED="%{"

33[01;31m'"%}"

YELLOW="%{"

33[01;33m'"%}"

BLUE="%{"

33[01;34m'"%}"

BOLD="%{"

33[01;39m'"%}"

NORM="%{"

33[00m'"%}"

autoload -Uz vcs_info
# prompt (if running screen, show window #)
if [ x$WINDOW != x ]; then
export PS1=”$WINDOW:%~%# “
else
export PS1=”
<${YELLOW}%~${NORM}>
${RED}%n${YELLOW}@${BLUE}%U%m%u$%(!.#.$) “
#export PS1=”[${RED}%n${YELLOW}@${BLUE}%U%m%u$:${GREEN}%2c${NORM}]%(!.#.$) “
#right prompt – time/date stamp
#export RPS1=”${GREEN}(%D{%m-%d %H:%M})${NORM}”
# this right prompt is for any kind of repository info – svn, git, mercurial ,etc. courtesy of vcs_info
export RPS1=”${YELLOW}%1v${NORM}”
fi
# format titles for screen and rxvt
function title() {
# escape ‘%’ chars in $1, make nonprintables visible
a=${(V)1//\%/\%\%}
# Truncate command, and join lines.
a=$(print -Pn “%40>…>$a” | tr -d “\n”)
case $TERM in
screen)
print -Pn “\ek$a:$3\e\\”      # screen title (in ^A”)
;;
xterm*|rxvt)
print -Pn “\e]2;$2 | $a:$3\a” # plain xterm title
;;
esac
}
# precmd is called just before the prompt is printed
function precmd() {
title “zsh” “$USER@%m” “%55<…<%~”
psvar=()
vcs_info
[[ -n $vcs_info_msg_0_ ]] && psvar[1]=”$vcs_info_msg_0_”
}
# preexec is called just before any command line is executed
function preexec() {
title “$1″ “$USER@%m” “%35<…<%~”
}
# this is ubuntu specific – in case you execute a command
# that is not installed, zsh automatically calls this handler
# so that you get a nice recommendation message (similar to bash)
function command_not_found_handler() {
/usr/bin/python /usr/lib/command-not-found — $1
}
# vi editing
# this prevents me from deleting a word using ESC-Backspace
#bindkey -v
# colorful listings
zmodload -i zsh/complist
zstyle ‘:completion:*’ list-colors ${(s.:.)LS_COLORS}
autoload -U compinit
compinit
# aliases
alias mv=’nocorrect mv’       # no spelling correction on mv
alias cp=’nocorrect cp’
alias mkdir=’nocorrect mkdir’
alias j=jobs
if ls -F –color=auto >&/dev/null; then
alias ls=”ls –color=auto -F”
else
alias ls=”ls -F”
fi
alias ll=”ls -l”
alias ..=’cd ..’
alias .=’pwd’
alias grep=’grep -E –color=always’
alias vim=’gvim’
alias ssh-linode=’ssh -l clearsenses li44-22.members.linode.com’
alias ssh-nsmg-core=’ssh clearsenses@64.85.169.69′
alias ssh-clearsenses-core=’ssh clearsenses@64.85.167.191′
alias ssh-nsmg=’ssh -l nsmg li50-150.members.linode.com’
alias ssh-darthvader=’ssh -l clearsenses 192.168.1.12′
export SBCL_HOME=/home/user/research/lisp/sbcl-1.0.29/release/lib/sbcl/
export SCALA_HOME=/usr
alias sbcl=’/home/user/research/lisp/sbcl-1.0.29/release/bin/sbcl’
export SBCL_HOME=/home/user/research/lisp/sbcl-1.0.29/release/lib/sbcl/
alias sbcl=’/home/user/research/lisp/sbcl-1.0.29/release/bin/sbcl’
#exports
#path=(/home/user/clearsenses/ruby-1.9.1-p243/release/bin $path)
#path=(/home/user/clearsenses/ruby-1.8.6-p383/release/bin $path)
path=(/home/user/clearsenses/ruby-enterprise-1.8.7-20090928/release/bin $path)
export PATH
export RUBYLIB=/home/user/clearsenses/ruby-1.8.6-p383/release/lib
export GEM_HOME=/home/user/clearsenses/GEMS-1.8
export GEM_PATH=$GEM_HOME
path=($GEM_PATH/bin $path)
#variables that need to be set for intellij – Ubuntu
export JDK_HOME=/usr/lib/jvm/java-6-sun-1.6.0.15/
export M2_HOME=/usr/share/maven2/
# functions
setenv() { export $1=$2 }  # csh compatibility
#bash style ctrl-a (beginning of line) and ctrl-e (end of line)
bindkey ‘^a’ beginning-of-line
bindkey ‘^e’ end-of-line
# key bindings
# Emulate tcsh’s backward-delete-word
tcsh-backward-delete-word () {
#local WORDCHARS=”${WORDCHARS:s#/#}”
#local WORDCHARS=’*?_[]~\/!#$%^<>|`@#$%^*()+?’
local WORDCHARS=”${WORDCHARS:s#/#}”
zle backward-delete-word
}
tcsh-backward-word () {
local WORDCHARS=”${WORDCHARS:s#/#}”
zle emacs-backward-word
}
tcsh-forward-word () {
local WORDCHARS=”${WORDCHARS:s#/#}”
zle emacs-forward-word
}
zle -N tcsh-backward-delete-word
zle -N tcsh-backward-word
zle -N tcsh-forward-word
# for escape backspace (delete a word) behavior similar to tcsh
bindkey ‘\e^?’ tcsh-backward-delete-word
#for ctrl leftarrow and rightarrow navigation
bindkey ‘;5D’ tcsh-backward-word
bindkey ‘;5C’ tcsh-forward-word
#if this is uncommented, it will ignore the stop-at-special-chars
#bindkey ‘\e^H’ backward-delete-word
#uncomment this to have a nice update script that will cause ur zshrc to update from a central location
#selfupdate(){
#        URL=”http://stuff.mit.edu/~jdong/misc/zshrc”
#        echo “Updating zshrc from $URL…”
#        echo “Press Ctrl+C within 5 seconds to abort…”
#        sleep 5
#        cp ~/.zshrc ~/.zshrc.old
#        wget $URL -O ~/.zshrc
#        echo “Done; existing .zshrc saved as .zshrc.old”
#}
#
#rsync -tzhhP rsync://cdimage.ubuntu.com/cdimage/daily/20090420.1/jaunty-alternate-i386.iso .

# historyHISTFILE=~/.zsh_historyHISTSIZE=5000SAVEHIST=1000setopt appendhistory autocd extendedglobsetopt EXTENDED_HISTORY # puts timestamps in the history

BLACK=”%{“

33[01;30m'"%}"GREEN="%{"

33[01;32m'"%}"RED="%{"

33[01;31m'"%}"YELLOW="%{"

33[01;33m'"%}"BLUE="%{"

33[01;34m'"%}"BOLD="%{"

33[01;39m'"%}"NORM="%{"

33[00m'"%}"
autoload -Uz vcs_info
# prompt (if running screen, show window #)if [ x$WINDOW != x ]; then    export PS1=”$WINDOW:%~%# “else      export PS1=”<${YELLOW}%~${NORM}>${RED}%n${YELLOW}@${BLUE}%U%m%u$%(!.#.$) “    #export PS1=”[${RED}%n${YELLOW}@${BLUE}%U%m%u$:${GREEN}%2c${NORM}]%(!.#.$) “    #right prompt – time/date stamp    #export RPS1=”${GREEN}(%D{%m-%d %H:%M})${NORM}”    # this right prompt is for any kind of repository info – svn, git, mercurial ,etc. courtesy of vcs_info    export RPS1=”${YELLOW}%1v${NORM}”fi
# format titles for screen and rxvtfunction title() {  # escape ‘%’ chars in $1, make nonprintables visible  a=${(V)1//\%/\%\%}
# Truncate command, and join lines.  a=$(print -Pn “%40>…>$a” | tr -d “\n”)
case $TERM in  screen)    print -Pn “\ek$a:$3\e\\”      # screen title (in ^A”)    ;;  xterm*|rxvt)    print -Pn “\e]2;$2 | $a:$3\a” # plain xterm title    ;;  esac}
# precmd is called just before the prompt is printedfunction precmd() {  title “zsh” “$USER@%m” “%55<…<%~”  psvar=()  vcs_info  [[ -n $vcs_info_msg_0_ ]] && psvar[1]=”$vcs_info_msg_0_”}
# preexec is called just before any command line is executedfunction preexec() {  title “$1″ “$USER@%m” “%35<…<%~”}
# this is ubuntu specific – in case you execute a command# that is not installed, zsh automatically calls this handler# so that you get a nice recommendation message (similar to bash)function command_not_found_handler() {     /usr/bin/python /usr/lib/command-not-found — $1}
# vi editing# this prevents me from deleting a word using ESC-Backspace#bindkey -v
# colorful listingszmodload -i zsh/complistzstyle ‘:completion:*’ list-colors ${(s.:.)LS_COLORS}
autoload -U compinitcompinit
# aliasesalias mv=’nocorrect mv’       # no spelling correction on mvalias cp=’nocorrect cp’alias mkdir=’nocorrect mkdir’alias j=jobsif ls -F –color=auto >&/dev/null; then  alias ls=”ls –color=auto -F”else  alias ls=”ls -F”fialias ll=”ls -l”alias ..=’cd ..’alias .=’pwd’alias grep=’grep -E –color=always’alias vim=’gvim’alias ssh-linode=’ssh -l clearsenses li44-22.members.linode.com’alias ssh-nsmg-core=’ssh clearsenses@64.85.169.69′alias ssh-clearsenses-core=’ssh clearsenses@64.85.167.191′alias ssh-nsmg=’ssh -l nsmg li50-150.members.linode.com’alias ssh-darthvader=’ssh -l clearsenses 192.168.1.12′export SBCL_HOME=/home/user/research/lisp/sbcl-1.0.29/release/lib/sbcl/export SCALA_HOME=/usralias sbcl=’/home/user/research/lisp/sbcl-1.0.29/release/bin/sbcl’export SBCL_HOME=/home/user/research/lisp/sbcl-1.0.29/release/lib/sbcl/alias sbcl=’/home/user/research/lisp/sbcl-1.0.29/release/bin/sbcl’
#exports#path=(/home/user/clearsenses/ruby-1.9.1-p243/release/bin $path)#path=(/home/user/clearsenses/ruby-1.8.6-p383/release/bin $path)path=(/home/user/clearsenses/ruby-enterprise-1.8.7-20090928/release/bin $path)export PATHexport RUBYLIB=/home/user/clearsenses/ruby-1.8.6-p383/release/libexport GEM_HOME=/home/user/clearsenses/GEMS-1.8export GEM_PATH=$GEM_HOMEpath=($GEM_PATH/bin $path)
#variables that need to be set for intellij – Ubuntuexport JDK_HOME=/usr/lib/jvm/java-6-sun-1.6.0.15/export M2_HOME=/usr/share/maven2/
# functionssetenv() { export $1=$2 }  # csh compatibility
#bash style ctrl-a (beginning of line) and ctrl-e (end of line)bindkey ‘^a’ beginning-of-linebindkey ‘^e’ end-of-line# key bindings
# Emulate tcsh’s backward-delete-wordtcsh-backward-delete-word () {    #local WORDCHARS=”${WORDCHARS:s#/#}”    #local WORDCHARS=’*?_[]~\/!#$%^<>|`@#$%^*()+?’    local WORDCHARS=”${WORDCHARS:s#/#}”    zle backward-delete-word}
tcsh-backward-word () {    local WORDCHARS=”${WORDCHARS:s#/#}”    zle emacs-backward-word}
tcsh-forward-word () {    local WORDCHARS=”${WORDCHARS:s#/#}”    zle emacs-forward-word}
zle -N tcsh-backward-delete-wordzle -N tcsh-backward-wordzle -N tcsh-forward-word
# for escape backspace (delete a word) behavior similar to tcshbindkey ‘\e^?’ tcsh-backward-delete-word#for ctrl leftarrow and rightarrow navigation bindkey ‘;5D’ tcsh-backward-wordbindkey ‘;5C’ tcsh-forward-word
#if this is uncommented, it will ignore the stop-at-special-chars#bindkey ‘\e^H’ backward-delete-word
#uncomment this to have a nice update script that will cause ur zshrc to update from a central location
#selfupdate(){#        URL=”http://stuff.mit.edu/~jdong/misc/zshrc”#        echo “Updating zshrc from $URL…”#        echo “Press Ctrl+C within 5 seconds to abort…”#        sleep 5#        cp ~/.zshrc ~/.zshrc.old#        wget $URL -O ~/.zshrc#        echo “Done; existing .zshrc saved as .zshrc.old”#}##rsync -tzhhP rsync://cdimage.ubuntu.com/cdimage/daily/20090420.1/jaunty-alternate-i386.iso .

2 Comments

  1. thank!

  2. Thanks

    To have the command not found utility working, i had to remove the dash before $1 :

    function command_not_found_handler() {
    /usr/bin/python /usr/lib/command-not-found $1
    }


Post a Comment

*
*