Created
July 3, 2016 01:36
-
-
Save cg505/6ef10e229d45c8c0d81498e220091d68 to your computer and use it in GitHub Desktop.
cg505.zshrc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fpath=(~/.zsh/completions $fpath) | |
| autoload -U compinit colors select-word-style | |
| select-word-style bash | |
| compinit | |
| colors | |
| alias ls='ls --color=auto' | |
| # function advise { | |
| # name="advice-$1-$2" | |
| # if type -p "$name" > /dev/null; then return; fi | |
| # alias super="$1" | |
| # eval " | |
| # function $name { | |
| # $3 | |
| # } | |
| # alias $1=$name | |
| # " | |
| # unalias super | |
| # } | |
| function short_ls { | |
| if [ `ls -1 | wc -l` -lt 100 ] | |
| then | |
| ls | |
| else | |
| echo "`ls -1 | wc -l` files" | |
| fi | |
| } | |
| function chpwd() { | |
| short_ls | |
| } | |
| if [[ -s "$HOME/.rvm/scripts/rvm" ]] | |
| then | |
| source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* | |
| # if type advise &> /dev/null; then | |
| # advise cd with-short-ls-and-rvm 'super $* && short_ls' | |
| # fi | |
| if [ ! -z "$rvm_path" ]; then | |
| mkdir -p "$rvm_path/tmp/$$" | |
| fi | |
| fi | |
| alias LS=sl | |
| alias Ls=sl | |
| alias lS=sl | |
| alias lol=sl | |
| alias lsd="sl && sl -a && sl -la && sl -laF && echo \"woah, dude\"" | |
| ## Pretty Prompt Configuration | |
| START_GREEN='' | |
| START_BLUE='' | |
| START_RED='' | |
| START_YELLOW='' | |
| START_MAGENTA='' | |
| END_COLOR='' | |
| # Colorful prompt for smart terminals | |
| if [ "$TERM" != "dumb" ]; then | |
| # START_GREEN="\[\033[01;32m\]" | |
| # START_BLUE="\[\033[01;36m\]" | |
| # START_RED="\[\033[01;31m\]" | |
| # START_YELLOW="\[\033[01;33m\]" | |
| # START_MAGENTA="\[\033[01;35m\]" | |
| START_GREEN="%{$fg_no_bold[green]%}" | |
| START_BLUE="%{$fg_no_bold[cyan]%}" | |
| START_RED="%{$fg_no_bold[red]%}" | |
| START_YELLOW="%{$fg_no_bold[yellow]%}" | |
| START_MAGENTA="%{$fg_no_bold[magenta]%}" | |
| END_COLOR="%{$reset_color%}" | |
| fi | |
| # Black/white prompt for dumb terminals | |
| PROMPT_MAIN="%n@%m${END_COLOR}" | |
| PROMPT_DIR="${START_BLUE}%~${END_COLOR}" | |
| PROMPT_HIST="${START_MAGENTA}[%!]${END_COLOR}" | |
| PROMPT_TIME="${START_YELLOW}[%*]${END_COLOR}" | |
| function sed_escape_dirs { | |
| echo "$@" | sed 's/\//\\\//g' | |
| } | |
| function pwd_with_tilde { | |
| pwd | sed s/"`sed_escape_dirs $HOME`"/~/ | |
| } | |
| function precmd { | |
| if [[ $? = "0" ]] | |
| then | |
| PROMPT_MAIN_COLOR="${START_GREEN}" | |
| else | |
| PROMPT_MAIN_COLOR="${START_RED}" | |
| fi | |
| # Git branch stuff from escherfan on Reddit | |
| if [ -n ${GITBRANCH} ]; then | |
| BRANCH=`old-git rev-parse --abbrev-ref HEAD 2> /dev/null` | |
| DIRTY=`[[ $(old-git status 2> /dev/null | tail -n1) != \ | |
| "nothing to commit, working directory clean" ]] && echo '·'` | |
| if [ $BRANCH ]; then | |
| BRANCH=" ${START_RED}($BRANCH${DIRTY})${END_COLOR}"; | |
| fi | |
| else | |
| BRANCH=''; | |
| fi | |
| if [ "$rvm_path" -a -e "$rvm_path/tmp/$$/prompt" ] | |
| then RVM_PROMPT=" ${START_YELLOW}(`cat "$rvm_path/tmp/$$/prompt"`)${END_COLOR}" | |
| else RVM_PROMPT='' | |
| fi | |
| RPROMPT="$PROMPT_HIST $PROMPT_TIME" | |
| if [ `pwd_with_tilde | wc -c` -lt '35' ]; then | |
| PROMPT="$PROMPT_MAIN_COLOR$PROMPT_MAIN:$PROMPT_DIR$BRANCH$RVM_PROMPT$PROMPT_VAR\$ " | |
| else | |
| PS1="┌$PROMPT_DIR$BRANCH$RVM_PROMPT | |
| └$PROMPT_MAIN_COLOR$PROMPT_MAIN$PROMPT_VAR\$ " | |
| fi | |
| } | |
| TMOUT=1 | |
| TRAPALRM() { | |
| zle reset-prompt | |
| } | |
| function green { | |
| return 0 | |
| } | |
| # function sudoit { | |
| # local line=${history[${#history}]} | |
| # sudo $line | |
| # } | |
| alias sudoit='sudo $(fc -ln -1)' | |
| function inst { | |
| sudo pacman -S $@ | |
| } | |
| function search { | |
| pacman -Ss $@ | |
| } | |
| # function provides { | |
| # dnf provides $@ | |
| # } | |
| setopt correct | |
| setopt HIST_IGNORE_DUPS | |
| setopt HIST_IGNORE_SPACE | |
| export HISTSIZE=1000 | |
| export HISTFILE="$HOME/.zsh_history" | |
| export SAVEHIST=$HISTSIZE | |
| alias old-git=`which git` | |
| alias git=hub | |
| # alias fuck=eval\ eval\ 'thefuck $(fc -ln -1 | tail -n 1);' | |
| # eval "$(thefuck --alias)" | |
| TF_ALIAS=fuck alias fuck='PYTHONIOENCODING=utf-8 eval $(thefuck $(fc -ln -1 | tail -n 1));' | |
| export ecn=.ecn.purdue.edu | |
| alias ec='emacsclient --alternate-editor= -c' | |
| alias clip='xclip -selection clip' | |
| export EDITOR='emacsclient --alternate-editor=vim -c' | |
| export GOPATH='/home/cooperc/gocode/' | |
| export PATH="$PATH:/home/cooperc/bin" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment