-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbash_profile
More file actions
103 lines (80 loc) · 2.79 KB
/
bash_profile
File metadata and controls
103 lines (80 loc) · 2.79 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
source ~/.profile
SCRIPT_PATH="${BASH_SOURCE[0]}";
if([ -h "${SCRIPT_PATH}" ]) then
while([ -h "${SCRIPT_PATH}" ]) do SCRIPT_PATH=`readlink "${SCRIPT_PATH}"`; done
fi
pushd . > /dev/null
cd `dirname ${SCRIPT_PATH}` > /dev/null
SCRIPT_PATH=`pwd`;
popd > /dev/null
alias bashreload="${SCRIPT_PATH}/install.sh"
alias reloadbash="bashreload"
alias dotsync=${SCRIPT_PATH}/bin/sync-dotfiles.sh
###################### Bash settings
export EDITOR=nano
if [ -f ${SCRIPT_PATH}/isProduction ]; then
export PS1='\[\033[0;31m\]\u@\h\[\033[0;36m\]:\w\[\033[00m\]: ' #red
else
export PS1='\[\033[0;32m\]\u@\h\[\033[0;36m\]:\w\[\033[00m\]: ' #green
fi
#export PS1='\[\033[0;33m\]\u@\h\[\033[0;36m\]:\w\[\033[00m\]: ' #yellow
export HISTCONTROL=ignoreboth
export HISTFILESIZE=50000
export HISTSIZE=50000
export PROMPT_COMMAND="history -n;$PROMPT_COMMAND" # Write/read from bash history after each command
export ACK_OPTIONS="-i --sort-files --color --follow --group"
shopt -s checkwinsize # check and update lines & cols after each cmd
# enable command and file completion after sudo
complete -f -c sudo
###################### Redefining default params
######## Color
if [ -x /usr/bin/dircolors ] ; then
eval "`dircolors -b`"
alias ls='ls -hF --color'
export GREP_OPTIONS='--color=auto'
fi
######## Use some nicer colors
export LSCOLORS="ExGxBxDxCxEgEdxbxgacad"
###################### Key control
bind '"\e[A"':history-search-backward
bind '"\e[B"':history-search-forward
bind '"\M-w"':"\"\C-k\C-ahistory | grep '^ *[0-9]* *\C-e.'\C-m\""
bind Space:magic-space # `svn diff !:2` inserts 2nd arg from previous
# Enable Ctrl+s to forward search through history http://stackoverflow.com/q/791765/6305
[[ $- == *i* ]] && stty -ixon
###################### Mac Settings
if [[ $OSTYPE == darwin* ]]; then
alias ls='ls -hFG'
export GREP_OPTIONS='--color=auto'
whatport() {
sudo lsof -i -P -n | grep LISTEN | grep :$1
}
fi
###################### Load external scripts
if [ -f ${SCRIPT_PATH}/aliases ]; then
source ${SCRIPT_PATH}/aliases
fi
if [ -f /etc/bash_completion ]; then
source /etc/bash_completion
fi
if [ -f ${SCRIPT_PATH}/git-completion ] && which git &> /dev/null; then
source ${SCRIPT_PATH}/git-completion
fi
if [ -f ${SCRIPT_PATH}/git-flow-completion ] && which git-flow &> /dev/null; then
source ${SCRIPT_PATH}/git-flow-completion
fi
if [ -f ~/.localrc ]; then
source ~/.localrc
fi
source ${SCRIPT_PATH}/fasd/fasd
eval "$(fasd --init auto)"
alias v="fasd -e vim"
alias vv="fasd -i -e vim"
###################### PATH + Private bin
if [ -d ${SCRIPT_PATH}/bin ] ; then
PATH="${SCRIPT_PATH}/bin:${SCRIPT_PATH}/bin/git-flow:$PATH"
fi
if [ -f "~/.docker/init-bash.sh" ]; then
source ~/.docker/init-bash.sh || true # Added by Docker Desktop
fi
[ -f ~/.fzf.bash ] && source ~/.fzf.bash