# The following lines were added by compinstall zstyle ':completion:*' completer _expand _complete _ignored _approximate zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'm:{[:lower:]}={[:upper:]}' 'r:|[._-_]=** r:|=**' '' zstyle :compinstall filename '~/.zshrc' zle_highlight=(default:bold) autoload -Uz compinit -D && compinit autoload -U promptinit && promptinit autoload -U colors && colors autoload -Uz VCS_INFO_get_data_git && VCS_INFO_get_data_git 2> /dev/null setopt prompt_subst # End of lines added by compinstall # Lines configured by zsh-newuser-install HISTFILE=~/.zsh_history HISTSIZE=1000 SAVEHIST=1000 setopt appendhistory autocd extendedglob nomatch notify bindkey -e # End of lines configured by zsh-newuser-install export HOMEBREW_NO_ANALYTICS=1 export GOPATH=~/.go export GOBIN=$GOPATH/bin export GHC_HOME=/usr/local/bin export CABAL_HOME=$HOME/.cabal/ export PATH=$GHC_HOME:$PATH:$CABAL_HOME/bin:/opt/local/bin:/usr/local/sbin:/usr/local/opt/llvm/bin:~/.local/bin:$GOBIN export MANPATH=$MANPATH:/opt/local/share/man:/usr/local/opt/erlang/lib/erlang/man export INFOPATH=$INFOPATH:/opt/local/share/info export PYTHONSTARTUP=~/.pythonrc export NODE_PATH=/usr/local/lib/node_modules export TERM=rxvt export LANG=en_US.UTF-8 export LC_ALL=$LANG export JAVA_HOME=`/usr/libexec/java_home -v 9` export GH_HOME=~/Documents/Code/Github export CARP_DIR=$GH_HOME/Carp/ export EDITOR=vim alias dob="git branch --merged | grep -vE '(\*)|(master)|(dev)' | xargs -n 1 git branch -d" alias vi="stty stop '' -ixoff ; stty erase '^?'; vim" alias gcc="gcc-7" alias g++="g++-7" alias mk="make" alias g="git" alias virtualenv2="python2.7 /usr/local/lib/python2.7/site-packages/virtualenv.py" alias ghci="ghci -v0" alias ghc-sandbox="ghc -no-user-package-db -package-db .cabal-sandbox/*-packages.conf.d" alias ghci-sandbox="ghci -no-user-package-db -package-db .cabal-sandbox/*-packages.conf.d" alias runhaskell-sandbox="runhaskell -no-user-package-db -package-db .cabal-sandbox/*-packages.conf.d" alias psg="ps aux | grep -v grep | grep -i -e VSZ -e" alias python="python3" alias pysh="ipython" alias pip2="/usr/local/bin/pip2" alias pip="pip3" alias setjdk="launchctl setenv STUDIO_JDK /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk" alias cdg="cd $GH_HOME" alias cdgo="cd ~/.go/src" alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash; sudo rm -rfv /private/var/log/asl/*.asl" alias loc="cloc --read-lang-def=/Users/veitheller/.scripts/cloc.txt *" alias ls="ls -a" alias quit="exit" alias clipboard_clear="echo lol | pbcopy" PROMPT="%{$fg[red]%}%n%{$fg[white]%} at %{$fg[green]%}%m%{$fg[white]%}"$'\n'"=> " expand-or-complete-with-dots(){ echo -n "e[31m.....\e[0m" zle expand-or-complete zle redisplay } zle -N expand-or-complete-with-dots bindkey "Î" expand-or-complete-with-dots precmd () {print -Pn "\e]2; %~/ \a"} preexec () {print -Pn "\e]2; %~/ \a"} insert_sudo () { zle beginning-of-line; zle -U "sudo " } zle -N insert-sudo insert_sudo bindkey "^[s" insert-sudo case $TERM in xterm*) precmd(){print -Pn "\e]0;%m: %~\a"} ssh(){ PRENAME="`dcop $KONSOLE_DCOP_SESSION sessionName`"; dcop "$KONSOLE_DCOP_SESSION" renameSession "$@"; /usr/bin/ssh "$@"; dcop "$KONSOLE_DCOP_SESSION" renameSession "$PRENAME" } ;; esac function rprompt-git-current-branch { local name st color gitdir action name=`git rev-parse --abbrev-ref=loose HEAD 2> /dev/null` if [[ -z $name ]]; then return fi gitdir=`git rev-parse --git-dir 2> /dev/null` action=`VCS_INFO_git_getaction "$gitdir"` && action="($action)" st=`git status 2> /dev/null` if [[ -n `echo "$st" | grep "ahead of"` ]]; then color=%F{white} elif [[ -n `echo "$st" | grep "^nothing to"` ]]; then color=%F{green} elif [[ -n `echo "$st" | grep "^no changes added"` ]]; then color=%F{yellow} elif [[ -n `echo "$st" | grep "^# Changes to be committed"` ]]; then color=%B%F{red} else color=%B%F{blue} fi echo "on %{$fg[white]%}$color$name$action%f%b %{$reset_color%}" } function cabal_sandbox_info() { cabal_files=(*.cabal(N)) if [ $#cabal_files -gt 0 ]; then if [ -f cabal.sandbox.config ]; then echo "%{$fg[white]%} is %{$fg[green]%}sandboxed%{$reset_color%}" else echo "%{$fg[white]%} is %{$fg[red]%}not sandboxed%{$reset_color%}" fi fi } RPROMPT='`rprompt-git-current-branch`' RPROMPT+="%{$fg[white]%}in %{$fg[yellow]%}%~%{$reset_color%}" RPROMPT+='`cabal_sandbox_info`' extract(){ if [ -f $1 ] ; then case $1 in *.tar.bz2) tar xjf $1 ;; *.tar.gz) tar xzf $1 ;; *.tar.xz) tar xzf $1 ;; *.bz2) bunzip2 $1 ;; *.rar) unrar x $1 ;; *.gz) gunzip $1 ;; *.tar) tar xf $1 ;; *.tbz2) tar xjf $1 ;; *.tgz) tar xzf $1 ;; *.zip) if [ -n $2 ] ; then unzip $1 -d $2 else unzip $1 fi;; *.Z) uncompress $1 ;; *.7z) 7z x $1 ;; *) echo "'$1' cannot be extracted via extract()" ;; esac else echo "'$1' is not a valid file" fi } mcd(){ mkdir -p $1 cd $1 } pinfo(){ top -pid `pgrep $1 | tr "\\n" "," | sed 's/,$//' | sed -e's/,/ -pid /g'` } save_dotfiles(){ local DOTPATH=~/Documents/Code/Github/.dotfiles/ cp -r ~/.scripts ${DOTPATH} cp ~/.bash_profile ${DOTPATH}bash_profile cp ~/.cardinalrc ${DOTPATH}cardinalrc cp ~/.erc ${DOTPATH}erc cp ~/.ghci ${DOTPATH}ghci cp ~/.gitconfig ${DOTPATH}gitconfig cp ~/.gitignore ${DOTPATH}gitignore cp ~/.inputrc ${DOTPATH}inputrc cp ~/.pip-upgrade ${DOTPATH}pip-upgrade cp ~/.pythonrc ${DOTPATH}pythonrc cp ~/.valgrindrc ${DOTPATH}valgrindrc cp ~/.vimrc ${DOTPATH}vimrc cp ~/.zeptorc ${DOTPATH}zeptorc cp ~/.zepsrc ${DOTPATH}zepsrc cp ~/.zshrc ${DOTPATH}zshrc } makepass(){ LEN=20 if [ $# -gt 1 ] ; then LEN=$1 fi cat /dev/urandom | base64 | head -c $LEN echo '' } massif() { valgrind --tool=massif --massif-out-file=massif.prof $1 && ms_print massif.prof | less } upgrade() { if [ -x /usr/local/bin/brew ] ; then brew update brew upgrade --all brew cleanup fi } function tree(){ find . | sed -e 's/[^\/]*\//|--/g' -e 's/-- |/ |/g' | $PAGER } ###-begin-npm-completion-### # # npm command completion script # # Installation: npm completion >> ~/.bashrc (or ~/.zshrc) # Or, maybe: npm completion > /usr/local/etc/bash_completion.d/npm # COMP_WORDBREAKS=${COMP_WORDBREAKS/=/} COMP_WORDBREAKS=${COMP_WORDBREAKS/@/} export COMP_WORDBREAKS if type complete &>/dev/null; then _npm_completion () { local si="$IFS" IFS=$'\n' COMPREPLY=($(COMP_CWORD="$COMP_CWORD" \ COMP_LINE="$COMP_LINE" \ COMP_POINT="$COMP_POINT" \ npm completion -- "${COMP_WORDS[@]}" \ 2>/dev/null)) || return $? IFS="$si" } complete -o default -F _npm_completion npm elif type compdef &>/dev/null; then _npm_completion() { local si=$IFS compadd -- $(COMP_CWORD=$((CURRENT-1)) \ COMP_LINE=$BUFFER \ COMP_POINT=0 \ npm completion -- "${words[@]}" \ 2>/dev/null) IFS=$si } compdef _npm_completion npm elif type compctl &>/dev/null; then _npm_completion () { local cword line point words si read -Ac words read -cn cword let cword-=1 read -l line read -ln point si="$IFS" IFS=$'\n' reply=($(COMP_CWORD="$cword" \ COMP_LINE="$line" \ COMP_POINT="$point" \ npm completion -- "${words[@]}" \ 2>/dev/null)) || return $? IFS="$si" } compctl -K _npm_completion npm fi ###-end-npm-completion-### function ghcl { git clone git@github.com:$1.git } fortune | cowsay # eval `opam config env` source ~/.zshrc.priv