Skip to content

Instantly share code, notes, and snippets.

@hserang
Last active July 24, 2018 17:01
Show Gist options
  • Save hserang/f649655f2b67b2c99c3f07589ef0e92d to your computer and use it in GitHub Desktop.
Save hserang/f649655f2b67b2c99c3f07589ef0e92d to your computer and use it in GitHub Desktop.

Revisions

  1. hserang revised this gist Jul 24, 2018. 1 changed file with 3 additions and 16 deletions.
    19 changes: 3 additions & 16 deletions bash_profile
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    # Todo: clean this up

    # NPM Package Location
    NPM_PACKAGES="${HOME}/.npm-packages"
    NODE_PATH="$NPM_PACKAGES/lib/node_modules:$NODE_PATH"
    @@ -12,22 +14,7 @@ MANPATH="$NPM_PACKAGES/share/man:$(manpath)"
    export PATH="$PATH:/usr/local/git/bin:/usr/local/bin"
    export NODE_PATH="/usr/local/bin/node"

    # rbenv stuffs
    #export PATH="$HOME/.rbenv/bin:$PATH"

    #eval "$(rbenv init -)"

    ##################### ALIASES ############################
    #########################################################
    #alias be="bundle exec"
    #alias c="bundle exec rails c"
    #alias s="bundle exec rails s"
    #alias cdpr="cd /Users/neil/Projects"
    #alias cdweb="cd /Users/neil/Work/soundtracking-web"
    #########################################################


    ################ bash completion? #######################
    ################ bash completion #######################
    #########################################################
    if [ -f $(brew --prefix)/etc/bash_completion ]; then
    . $(brew --prefix)/etc/bash_completion
  2. hserang created this gist Jul 24, 2018.
    92 changes: 92 additions & 0 deletions bash_profile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,92 @@
    # NPM Package Location
    NPM_PACKAGES="${HOME}/.npm-packages"
    NODE_PATH="$NPM_PACKAGES/lib/node_modules:$NODE_PATH"

    PATH="$NPM_PACKAGES/bin:$PATH"

    # Unset manpath so we can inherit from /etc/manpath via the `manpath`
    # command
    unset MANPATH # delete if you already modified MANPATH elsewhere in your config
    MANPATH="$NPM_PACKAGES/share/man:$(manpath)"

    export PATH="$PATH:/usr/local/git/bin:/usr/local/bin"
    export NODE_PATH="/usr/local/bin/node"

    # rbenv stuffs
    #export PATH="$HOME/.rbenv/bin:$PATH"

    #eval "$(rbenv init -)"

    ##################### ALIASES ############################
    #########################################################
    #alias be="bundle exec"
    #alias c="bundle exec rails c"
    #alias s="bundle exec rails s"
    #alias cdpr="cd /Users/neil/Projects"
    #alias cdweb="cd /Users/neil/Work/soundtracking-web"
    #########################################################


    ################ bash completion? #######################
    #########################################################
    if [ -f $(brew --prefix)/etc/bash_completion ]; then
    . $(brew --prefix)/etc/bash_completion
    fi
    #########################################################


    ##################### PROMPT ############################
    #########################################################
    function parse_git_branch {
    git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1) / '
    }

    export -f parse_git_branch

    function parse_host_name {
    #echo sr`echo $HOSTNAME 2> /dev/null | sed -e s/[^0-9]//g`
    echo $HOSTNAME
    }

    function format_time {
    echo '[$(date +%H:%M:%S)]'
    }

    function proml {
    local BLUE="\[\033[0;34m\]"
    local LIGHT_BLUE="\[\033[1;34m\]"
    local RED="\[\033[0;31m\]"
    local LIGHT_RED="\[\033[1;31m\]"
    local GREEN="\[\033[0;32m\]"
    local LIGHT_GREEN="\[\033[1;32m\]"
    local WHITE="\[\033[1;37m\]"
    local GRAY="\[\033[0;37m\]"
    local LIGHT_GRAY="\[\033[1;37m\]"
    case $TERM in
    xterm*)
    TITLEBAR='\[\033]0;\u@\h:\w\007\]'
    ;;
    *)
    TITLEBAR=""
    ;;
    esac

    #Old main line:
    #$BLUE$(format_time) $LIGHT_RED$(parse_host_name):\W$GREEN \$(parse_git_branch)\

    PS1="${TITLEBAR}\
    $LIGHT_RED$(parse_host_name)$GRAY:$LIGHT_BLUE\W$GREEN \$(parse_git_branch)\
    $GRAY\$ $WHITE"
    PS2='> '
    PS4='+ '
    }
    proml
    ###########################################################

    ###################### Colored Less ######################
    ##########################################################
    export LESSOPEN="| /usr/local/bin/src-hilite-lesspipe.sh %s"
    export LESS=' -R '
    ##########################################################

    export N_PREFIX="$HOME/n"; [[ :$PATH: == *":$N_PREFIX/bin:"* ]] || PATH+=":$N_PREFIX/bin" # Added by n-install (see http://git.io/n-install-repo).