-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbash_profile
60 lines (48 loc) · 1.59 KB
/
bash_profile
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
# Essentials
export EDITOR=vim
export CLICOLOR=1
set -o vi
function git_prompt_info() {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
}
# Checks if working tree is dirty
parse_git_dirty() {
local SUBMODULE_SYNTAX=''
if [[ $POST_1_7_2_GIT -gt 0 ]]; then
SUBMODULE_SYNTAX="--ignore-submodules=dirty"
fi
if [[ -n $(git status -s ${SUBMODULE_SYNTAX} 2> /dev/null) ]]; then
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
else
echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
fi
}
export PS1='\[\e[0;33m\]✪ \[\e[0;22m\]\h\[\e[m\] \[\e[0;33m\]\W\[\e[m\] \[\e[0;34m\]$(git_prompt_info)\[\e[m\] \[\e[0;33m\]>\[\e[m\] '
## other good icons
# PATH Modifications
## For curl bundle
export SSL_CERT_FILE='/usr/local/opt/curl-ca-bundle/share/ca-bundle.crt'
## For Homebrew
PATH="/usr/local/sbin:$PATH"
PATH="/usr/local/bin:$PATH"
## For chruby
source /usr/local/share/chruby/chruby.sh
chruby ruby
source /usr/local/share/chruby/auto.sh
## For user-defined functions
PATH="$HOME/bin:$PATH"
PATH=".git/safe/../../bin:$PATH"
export PATH
# Import other user-defined functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# Keep track of more commands
export HISTFILESIZE=1000000
function top-commands {
history | awk '($2 ~ /^[[:alnum:]]+$/) { ++a[$2]; t = length($2); if (t > l) l = t; } END { for (i in a) printf("%s%" (l - length(i) + 1) "s%5.2f%%\n", i, " ", (a[i] * 100 / NR)); }' | sort -n -k2 -r | more
}
function top-commands-all {
history | sed -e 's/ *[0-9][0-9]* *//' | sort | uniq -c | sort -rn | head -10
}