-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy path_bashrc
107 lines (93 loc) · 4.09 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# vi: ft=sh
#### Bash customization. ####
export EDITOR="vim"
export PS1="\w $ "
export CLICOLOR=yes # Enable color ls output
export TERM=xterm-color # Flag terminal as color-capable
export GREP_OPTIONS='--color=auto'
# Ref: http://excid3.com/blog/how-to-fix-esc-in-your-terminal/#.UkHeamSZ3d6
export LESS="-eirMX"
# Enable X11 tunneling through ssh
if [ -z $DISPLAY ]; then export DISPLAY=":0.0"; fi
export P4DIFF=vimdiff p4 diff # Use vimdiff for P4 diff.
#### Add some paths to $PATH. ####
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
BASHRC_INCLUDES=$DIR/bashrc_includes
export PATH=$PATH:$DIR/scripts
# Bring homebrew, Ruby, and Rust binary packages into path
export PATH="/opt/homebrew/opt/openjdk/bin:$PATH"
export PATH="/opt/homebrew/bin:$PATH"
export PATH="/opt/homebrew/opt/ruby/bin:$PATH"
export PATH="$PATH:/Users/ashishb/.cargo/bin"
export PATH="$PATH:$HOME/go/bin/"
export PATH="$PATH:/Applications/PyCharm CE.app/Contents/MacOS"
export PATH="$PATH:$HOME/.local/bin"
alias charm=pycharm
alias rbm=rubymine
alias gl=goland
# A function to change title (works in iTerm).
function title {
echo -ne "\033]0;"$*"\007"
}
#### Source more scripts. ####
# Bash history customizations.
source $BASHRC_INCLUDES/bash_history_customization.bash
# For homebrew on Mac.
if [[ `uname -s` == "Darwin" ]]; then
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
fi
# Makefile auto-completion
complete -W "\`grep -oE '^[a-zA-Z0-9_.-]+:([^=]|$)' Makefile | sed 's/[^a-zA-Z0-9_.-]*$//'\`" make
# Go sub-modules should always be enabled now
export GO111MODULE=on
# Disable homrew analytics (https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Analytics.md)
export HOMEBREW_NO_ANALYTICS=1
# Disable Gatekeeper's quarantine - https://github.com/Homebrew/homebrew-cask/issues/52128#issuecomment-422436221
export HOMEBREW_CASK_OPTS=--no-quarantine
alias start_web_server='echo Starting webserver at http://$(ipconfig getifaddr en0):8000 && python -m SimpleHTTPServer 8000'
alias docker_image_size_mac='Docker image size:" "$(du -shc ~/Library/Containers/com.docker.docker/ | tail -n 1 | cut -f1)'
alias docker_cache_size='du -shc /Users/ashishb/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw'
# Other MacOS directories to look at when disk is full
# ~/Library/Caches
# ~/Library/Caches/JetBrains/ - this contains lots of stray IntelliJ installations
# ~/Library/Logs
# export JAVA_HOME=$(/usr/libexec/java_home -v1.8)
# export JAVA_HOME=$(/usr/libexec/java_home -v12)
# Hide Java icon (https://bia.is/android-dev-tip-hide-that-annoying-java-icon/)
export JAVA_TOOL_OPTIONS="-Dapple.awt.UIElement=true"
# Due to some issue, this produces "nospace: unbound variable" under `set -o nounset`.
# Therefore, I have to put it outside that.
if [ -f /usr/local/share/bash-completion/bash_completion ]; then
. /usr/local/share/bash-completion/bash_completion
fi
# Ref: http://robertmuth.blogspot.com/2012/08/better-bash-scripting-in-15-minutes.html
set -o nounset
# Better auto complete.
source $BASHRC_INCLUDES/better_autocomplete.bash
# adb auto-completion.
source $BASHRC_INCLUDES/adb.bash
# git auto-completion.
source $BASHRC_INCLUDES/git-completion.bash
# Yarn auto-completion
source $BASHRC_INCLUDES/yarn-completion/yarn-completion.bash
# Custom aliases to improve productivity.
source $BASHRC_INCLUDES/custom_aliases.bash
# Source local aliases.
touch $BASHRC_INCLUDES/local_aliases.bash && source $BASHRC_INCLUDES/local_aliases.bash
set +o nounset
# Keep these two files out of nounset (I will fix them some day).
# An interesting bash prompt.
source $BASHRC_INCLUDES/50_prompt.bash
# Source 'z' - easy jumping around without providing full path names.
source $BASHRC_INCLUDES/z/z.sh
# Obsolete ones
# # p4 auto-completion
# source $BASHRC_INCLUDES/p4_autocomplete.bash
# # Maven (mvn) auto-completion.
# source $BASHRC_INCLUDES/maven-bash-completion/bash_completion.bash
# # gradle auto-completion
# source $BASHRC_INCLUDES/gradle_autocomplete.bash
# # Custom aliases for android reverse engineering.
# source $BASHRC_INCLUDES/android_reverse_engineering_related_aliases.bash