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.
# Todo: clean this up
# 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"
################ 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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment