Skip to content

Instantly share code, notes, and snippets.

@seancdavis
Last active January 24, 2024 17:10

Revisions

  1. seancdavis revised this gist Sep 3, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion zshrc
    Original file line number Diff line number Diff line change
    @@ -103,7 +103,7 @@ function battery_charge() {

    PROMPT='
    $fg[cyan]%n $fg[white]on $fg[magenta]%m $fg[yellow]$(get_pwd) $(git_prompt_info)$(put_spacing)$(battery_charge)
    $reset_color> '
    > '

    # ALIASES
    #######################################################
  2. seancdavis revised this gist Apr 4, 2014. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions zshrc
    Original file line number Diff line number Diff line change
    @@ -45,10 +45,10 @@ plugins=(git rails ruby)
    source $ZSH/oh-my-zsh.sh

    # Customize to your needs...
    export PATH=$HOME/.rbenv/bin:/usr/local/bin:/Users/sdavis/.bin:$HOME/.bin:$PATH
    export PATH=$HOME/.rbenv/bin:/usr/local/bin:$HOME/.bin:$PATH

    # load rbenv automatically
    eval "$(rbenv init -)"
    eval "$(rbenv init - zsh)"

    # PROMPT
    #######################################################
  3. seancdavis renamed this gist Apr 4, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. seancdavis created this gist Apr 4, 2014.
    164 changes: 164 additions & 0 deletions .zshrc
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,164 @@
    # 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="alanpeabody"

    # Example aliases
    # alias zshconfig="mate ~/.zshrc"
    # alias ohmyzsh="mate ~/.oh-my-zsh"

    # Set to this to use case-sensitive completion
    # CASE_SENSITIVE="true"

    # Uncomment this to disable bi-weekly auto-update checks
    # DISABLE_AUTO_UPDATE="true"

    # Uncomment to change how often before auto-updates occur? (in days)
    # export UPDATE_ZSH_DAYS=13

    # 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 to disable command autocorrection
    # DISABLE_CORRECTION="true"

    # Uncomment following line if you want red dots to be displayed while waiting for completion
    # COMPLETION_WAITING_DOTS="true"

    # Uncomment following line if you want to disable marking untracked files under
    # VCS as dirty. This makes repository status check for large repositories much,
    # much faster.
    # DISABLE_UNTRACKED_FILES_DIRTY="true"

    # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
    # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
    # Example format: plugins=(rails git textmate ruby lighthouse)
    plugins=(git rails ruby)

    source $ZSH/oh-my-zsh.sh

    # Customize to your needs...
    export PATH=$HOME/.rbenv/bin:/usr/local/bin:/Users/sdavis/.bin:$HOME/.bin:$PATH

    # load rbenv automatically
    eval "$(rbenv init -)"

    # PROMPT
    #######################################################
    function get_pwd() {
    echo "${PWD/$HOME/~}"
    }

    function put_spacing() {
    local git=$(git_prompt_info)
    if [ ${#git} != 0 ]; then
    ((git=${#git} - 10))
    else
    git=0
    fi

    local bat=$(battery_charge)
    if [ ${#bat} != 0 ]; then
    ((bat = ${#bat} - 15))
    else
    bat=0
    fi

    local termwidth
    (( termwidth = ${COLUMNS} - 5 - ${#USER} - ${#HOST} - ${#$(get_pwd)} - ${bat} - ${git} ))

    local spacing=""
    for i in {1..$termwidth}; do
    spacing="${spacing} "
    done
    echo $spacing
    }

    ZSH_THEME_GIT_PROMPT_PREFIX="["
    ZSH_THEME_GIT_PROMPT_SUFFIX="]$reset_color"
    ZSH_THEME_GIT_PROMPT_DIRTY="$fg[red]+"
    ZSH_THEME_GIT_PROMPT_CLEAN="$fg[green]"

    function git_prompt_info() {
    ref=$(git symbolic-ref HEAD 2> /dev/null) || return
    echo "$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_PREFIX$(current_branch)$ZSH_THEME_GIT_PROMPT_SUFFIX"
    }

    function battery_charge() {
    if [ -e ~/.bin/batcharge.py ]
    then
    ~/.bin/batcharge.py
    #echo `python ~/.bin/batcharge.py`
    else
    echo '';
    fi
    }

    PROMPT='
    $fg[cyan]%n $fg[white]on $fg[magenta]%m $fg[yellow]$(get_pwd) $(git_prompt_info)$(put_spacing)$(battery_charge)
    $reset_color> '

    # ALIASES
    #######################################################
    alias ll='ls -lAFGh'
    alias whatsmyip='ipconfig getifaddr en1'

    function mkd {
    mkdir $1;
    cd $1;
    }

    alias vi=vim
    alias v=vim
    alias h='history'
    alias fh='history | grep $1' #Requires one input
    ft() { echo -n "(╯°□°)╯︵ ┻━┻" | pbcopy; }

    alias c='clear'

    # alias ztr='tar -czvf $1 $2' #create a tarball
    # alias zls='tar -tzf $1' #ls a tarball
    # alist zun='tar -xzvf $1' #extract a tarball

    alias md='open -a Marked'
    alias mate='open -a TextMate'

    alias box='cd ~/Dropbox'
    alias drive='cd ~/Google\ Drive'
    alias dl='cd ~/Downloads'
    alias notes='cd ~/Dropbox/notes'
    alias home='cd ~'

    alias g='git'
    alias gs='git status'
    alias ga="git add"
    alias ga.="git add ."
    alias gb='git branch --verbose'
    alias gc='git commit --verbose -m'
    alias gca='git commit --verbose --all -m'
    alias gush='git push'
    alias gushom='git push origin master'
    alias gco="git checkout"
    alias gd='git diff --ignore-space-change'
    alias gull='git pull'
    alias gullom='git pull origin master'
    alias gm="git merge"
    alias gash="git stash"
    alias gog="git log --pretty=format:\"%h - %an, %ar : %s\""

    alias shlvl="echo $SHLVL"
    alias flush_dns="sudo killall -HUP mDNSResponder"

    alias be="bundle exec"

    alias r1="rbenv global 1.9.3"
    alias r2="rbenv global 2.0.0"

    alias rt="rtask"