-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbash_profile.bash
executable file
·103 lines (81 loc) · 1.94 KB
/
bash_profile.bash
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
__hotoku_source_if_exists(){
path=$1
[ -f ${path} ] && source ${path}
}
# conda
_conda(){
local commands="activate
deactivate
clean
config
create
help
info
init
install
list
package
remove
uninstall
run
search
update
upgrade
build
convert
ndebug
develop
env
index
inspect
metapackage
render
server
skeleton
verify"
local cur=${COMP_WORDS[COMP_CWORD]}
local prev=${COMP_WORDS[COMP_CWORD-1]}
if [ ${prev} = conda ]; then
local cand=${commands[@]}
elif [ ${prev} = activate ]; then
local cand=$(conda env list | grep -v "#" | awk '{print $1}')
fi
COMPREPLY=($(compgen -W "${cand[@]}" -- "${cur}"))
}
which conda > /dev/null 2>&1 && complete -F _conda conda
# history
export HISTSIZE=50000
export HISTFILESIZE=500000
export EDITOR=emacsclient
export HISTTIMEFORMAT="%d/%m/%y %T "
# alias
alias gst="git status"
alias gc="git commit"
alias tiga="tig --all"
alias fin="find . -type d -name .git -prune -o -type f -print"
# direnv
which direnv > /dev/null 2>&1 && eval "$(direnv hook bash)"
## git completion
__hotoku_source_if_exists /usr/local/etc/bash_completion.d/git-completion.bash
__hotoku_source_if_exists /usr/local/etc/bash_completion.d/git-prompt.sh
# ps1
if declare -F __git_ps1 > /dev/null; then
export PS1='\[\e[0;32m\]\W\[\e[00m\]\[\e[0;33m\]$(__git_ps1 "[%s]")\[\e[00m\] \$ '
else
export PS1='\[\e[0;32m\]\W\[\e[00m\]\[\e[0;33m\]\[\e[00m\] \$ '
fi
# fzf
__hotoku_source_if_exists ~/.fzf.bash
__hotoku_source_if_exists ~/projects/dot/fzf-extras/fzf-extras.sh
# gcloud
__hotoku_source_if_exists /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.bash.inc
__hotoku_source_if_exists /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.bash.inc
# gh
if which gh > /dev/null; then
eval "$(gh completion -s bash)"
fi
## rbenv
[[ -d ~/.rbenv ]] && \
export PATH=${HOME}/.rbenv/bin:${PATH} && \
eval "$(rbenv init -)"
unset -f __hotoku_source_if_exists