-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bashrc
83 lines (67 loc) · 2.71 KB
/
.bashrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#### History settings ####
# don't put duplicate lines in the history. See bash(1) for more options
# don't overwrite GNU Midnight Commander's setting of `ignorespace'.
HISTCONTROL=$HISTCONTROL${HISTCONTROL+,}ignoredups
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
case "$TERM" in
"screen-256color") TERM=xterm-256color
esac
#### Colorify; it's good for the eyes. ####
export CLICOLOR=true
export LSCOLORS='cxgxfxfxbxexexhbadbxbx'
#### Load aliases from ~/.bash_aliases ####
if [ -f "$HOME/.bash_aliases" ]; then
. "$HOME/.bash_aliases"
fi
#### Enable programmable bash completion features; best cure for laziness. ####
if [ -f `brew --prefix`/etc/bash_completion ]; then
. `brew --prefix`/etc/bash_completion
fi
#### Command prompt ####
function git_info {
## get git branch for prompt
repo_dir=$(git rev-parse --show-toplevel 2>/dev/null);
if [ ! -z "$repo_dir" ]; then
echo -en "\033[1;30m // git: \033[0;36m"
echo -en $(echo $repo_dir |sed "s|$HOME|~|g")
echo -en "\033[0;30m | "
if [ -n "$(git status |grep 'nothing to commit')" ]; then
echo -en "\033[0;32m"
elif [ -n "$(git status |grep '# Changes ')" ]; then
echo -en "\033[0;31m"
else
echo -en "\033[0;36m"
fi
echo -en $(git branch --no-color 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
fi
}
export PS1='\[\033[1;30m\][$(date +%T)] \n\[\033[0;33m\]\h:\[\033[1;32m\]\w \[\033[0;36m\]$(git_info) \[\033[1;31m\]\n$ \[\033[0m\]'
#export PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"'
function stt() {
## set terminal title
echo -en "\033]2;$1\007"
#PS1=$(echo $PS1 |sed 's/^.*\\007//')
#export PS1="\033]0;$1\007$PS1"
}
#### Set title of terminal to last command; for ssh command, set it to hostname ####
#trap 'printf "\033]0; `history 1 |perl -p -e"s/^ssh //" |cut -b8-` \007"' DEBUG
#### Paths ####
export PATH=$HOME/bin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$HOME/go/bin:$HOME/src/fk/go/bin:/usr/local/opt/go/libexec/bin:$PATH
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home
alias java_ls='/usr/libexec/java_home -V 2>&1 | grep -E "\d.\d.\d[,_]" | cut -d , -f 1 | colrm 1 4 | grep -v Home'
function java_use() {
export JAVA_HOME=$(/usr/libexec/java_home -v $1)
export PATH=$JAVA_HOME/bin:$PATH
java -version
}
#### Options for other programs ####
export EDITOR=vim
export M2_HOME= # Has become necessary to run maven, unsure why
export GOPATH=$HOME/go:$HOME/src/fk/go
export DOCKER_HOST=tcp://192.168.59.103:2376
export DOCKER_CERT_PATH=/Users/siddhartha/.boot2docker/certs/boot2docker-vm
export DOCKER_TLS_VERIFY=3