From: Jer Noble Date: Thu, 17 Jan 2013 07:54:10 +0000 (-0800) Subject: Add zsh configuration equivalents. X-Git-Url: http://id.pley.net/dotfiles.git/commitdiff_plain/a971bbeba25ddc6b895b58ed3887ab5a506fad11?ds=sidebyside Add zsh configuration equivalents. --- diff --git a/install.sh b/install.sh index 735412b..1ee6e55 100755 --- a/install.sh +++ b/install.sh @@ -4,3 +4,4 @@ ln -hfs $PWD/aliases ~/.aliases ln -hfs $PWD/bash_login ~/.bash_login ln -hfs $PWD/ssh_config ~/.ssh/config ln -hfs $PWD/vimrc ~/.vimrc +ln -hfs $PWD/zsh_login ~/.zlogin diff --git a/zsh_aliases b/zsh_aliases new file mode 100644 index 0000000..80f9c85 --- /dev/null +++ b/zsh_aliases @@ -0,0 +1,66 @@ +#!/bin/zsh + +# The following aliases vary depending on the host OS: +case "$(uname -s)" in + Linux ) + alias ls='ls -F --color=auto' + ;; + Darwin ) + alias ls='ls -FG' + ;; +esac + +alias m='pine' +alias beep='echo ' +alias history='fc -l 0' +alias h='history' +alias hm='h | more' +alias hrm="h -r | more" +alias hh='h -r | head' +alias ht='h 10' +alias p='ps -au' +alias tf='tail -25f' +alias l='ls -lF' +alias la='ls -laF' +alias clr='clear' +alias cls='clear' +alias d='date' +alias vi='vim ' +alias v='vi' +alias vt='vi -t' +alias ta='vi -t' +alias wh='whoami' +alias new='frm -s new' +alias du='du -k' +alias df='df -k' +alias shizzle="perl -pe 's/\b(\w*[^aoeuiy])[aoeuiy]+[bcdfghjklmnpqrstvwxz]*\w\b/\1izzle/g'" + +function lh () { last $@ | head; } +function ll () { ls -ltF $@ | head; } +function lu () { ls -ltuF $@ | head; } +function lum () { ls -ltuF $@ | more; } +function lut () { ls -ltuF $@ | tail; } +function lm () { ls -ltF $@ | more; } +function lt () { ls -ltF $@ | tail; } +function lk () { ls -sltF $@ | sort -nr | head; } +function lkm () { ls -sltF $@ | sort -nr | more; } +function lkt () { ls -sltF $@ | sort -nr | tail; } +function lf () { ls -lt $(find $1 -name $2 -print); } +function vif () { vi $(find $1 -name $2 -print); } +function viw () { vi $(which $1); } +function toss () { mv -f $@ ~/.trashcan; } +function xcopy () { tar cvf - -C $1 $1/* | tar xvf - -C $2; } +function checkdns () { ping $( grep nameserver /etc/resolv.conf | awk '{print $2}' | head -1); } + +if [[ $(/usr/bin/which -s pidof) -eq 0 ]]; then + function pidof () { ps -e -o pid,comm | grep "$1" | awk '{print $1}'; } +fi + +function ssh-forget() { + sed -i "" "/^$1,/d" ~/.ssh/known_hosts +} + +function ssh-learn() { + sed -i "" "/^$1,/d" ~/.ssh/known_hosts + ssh-keyscan -t rsa $1 >> ~/.ssh/known_hosts +} diff --git a/zsh_login b/zsh_login new file mode 100644 index 0000000..80d35cf --- /dev/null +++ b/zsh_login @@ -0,0 +1,39 @@ +#!/bin/zsh + +autoload colors zsh/terminfo +if [[ "$terminfo[colors]" -ge 8 ]]; then + colors +fi + +autoload -U compinit +compinit + +# Set up VCS Prompt +autoload -Uz vcs_info +vcs_info +zstyle ':vcs_info:*' formats '[%b]' +zstyle ':vcs_info:*' actionformats '[%b|%a]' + +precmd() { + psvar=() + vcs_info + [[ -n $vcs_info_msg_0_ ]] && psvar[1]="$vcs_info_msg_0_" +} + +setopt PROMPT_SUBST +setopt INC_APPEND_HISTORY +setopt SHARE_HISTORY +PS1=$'\(zsh) %(?.%F{green}:-\)%f.%F{red}:-(%f) %(1v.%1v .)%n@%m:%(3~,.../,)%2~> ' +PATH=~/bin:$PATH + +HISTFILE=~/.zsh_history +HISTSIZE=5000 +SAVEHIST=1000 + +export MANPATH=~/man:$MANPATH +export EDITOR=/usr/bin/vim +export LSCOLORS=gxfxcxdxbxegedabagacad + +source ~/.dotfiles/zsh_aliases +source ~/.dotfiles/zsh_webkit_login + diff --git a/zsh_webkit_login b/zsh_webkit_login new file mode 100644 index 0000000..555e6d5 --- /dev/null +++ b/zsh_webkit_login @@ -0,0 +1,21 @@ +#/bin/zsh + +switchto() { + export OLD_WEBKIT_DIR=$WEBKIT_DIR + export WEBKIT_DIR=~/Projects/WebKit.$1 + export WEBKIT_OUTPUTDIR=$WEBKIT_DIR/OpenSource/WebKitBuild + if [[ "$OLD_WEBKIT_DIR" == "" ]]; then + export PATH=$PATH:$WEBKIT_DIR/OpenSource/Tools:$WEBKIT_DIR/OpenSource/Tools/Scripts:$WEBKIT_DIR/Internal/Tools/Scripts + else + export PATH=$(echo $PATH | sed -e "s;$OLD_WEBKIT_DIR;$WEBKIT_DIR;g") + fi + export OLD_WEBKIT_DIR= + + alias opensource="cd $WEBKIT_DIR/OpenSource" + alias internal="cd $WEBKIT_DIR/Internal" +} + +_webkit_dirs() { compadd $( for dir in ~/Projects/WebKit.*; do echo ${dir##*.}; done ) } +_switchto() { _arguments '1:dir:_webkit_dirs' } + +compdef _switchto switchto