-
Notifications
You must be signed in to change notification settings - Fork 0
/
bash_profile
133 lines (107 loc) Β· 3.22 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
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File and directory shortcuts
alias ...='cd ../../'
alias ..='cd ../'
alias ack="ack -l"
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias filecount="ls -1R | grep -v ^$ | grep -v :$ | wc -l"
alias grep='grep --color=auto'
# Git shortcuts
alias gb="git branch"
alias gd="git diff"
alias gs="git status"
alias gl="git log --graph"
alias gr="git reset --soft HEAD~1"
# See https://the.exa.website/
alias la='exa -bhHla --git'
alias ll='exa -bhHl --git'
alias ls='exa -bhH'
# Reload your bash profile
alias reload="source ~/.bash_profile"
# Set screenshot default directory
alias updatescreenshots="defaults write com.apple.screencapture location ~/Pictures/Screenshots; killall SystemUIServer"
# Load/unload GlobalProtect
alias {unloadvpn,unloadglobalprotect,killvpn}="launchctl unload /Library/LaunchAgents/com.paloaltonetworks.gp.pangp*"
alias {loadvpn,loadglobalprotect,startvpn}="launchctl load /Library/LaunchAgents/com.paloaltonetworks.gp.pangp*"
# Hide macOS Upgrade Notifications
alisas hideupdates="defaults write com.apple.systempreferences AttentionPrefBundleIDs 0"
function cd() {
command cd "$@";
setPS1
command exa -bhHll --git
# if [ -d .git ]; then
# command git status
# fi;
}
function clean() {
rm -rf ~/Library/Developer/Xcode/DerivedData/*
rm -rf ~/.Trash/*
DIR="/Users/robbking/Library/Developer/Xcode/DerivedData"
if [ "$(ls $DIR)" ]; then
echo 'Something went wrong, try cleaning manually.'
open $DIR
else
echo 'Successfully removed all Xcode derived data!'
git status
fi
}
function filetypecount() {
find . -iname "*.$@" | wc -l
}
function cgrep() {
command grep "$@" | sed 's/^ *//g' | tr '\n' ' ' | pbcopy
pbpaste
}
function setPS1() {
#Color reference
#Black 0;30
#Blue 0;34 Light Blue 1;34
#Brown 0;33
#Cyan 0;36 Light Cyan 1;36
#Gray 1;30 Light Gray 0;37
#Green 0;32 Light Green 1;32
#Purple 0;35 Light Purple 1;35
#Red 0;31 Light Red 1;31
#White 1;37
#Yellow 1;33
#Grey prompt
#export PS1="\n\e[2m[\t]\e[0m $PWD\e[0;31m:\e[0m"
#Blue prompt
#export PS1="\n\[\e[0;34m\][\t]\[\e[m\] $PWD\e[0;31m:\e[0m"
#Hybrid prompt
export PS1="\n\[\e[0;34m\][\t]\[\e[m\] \e[1;37m\]$PWD\[\e[m\e[0;31m:\e[0m"
#Emoji prompt
#export PS1="\n\[\e[0;34m\][\t]\[\e[m\] π \e[1;37m\]$PWD\[\e[m\e[0;31m:\e[0m"
# π¦ πΏ π² π π¦ π π¦ βΊ β° π π π₯ π¨π»βπ
#Windows style prompt
# export PS1="c:$PWD/"
#Two line prompt
#export PS1="\e[1;37m\]$PWD\[\e[m\e[0;31m\e[0m \n\[\e[0;34m\][\t]\[\e[m\]:"
#Hybrid prompt (current directory name only)
#export PS1="\[\e[0;34m\][\t]\[\e[m\] \e[1;37m\]${PWD##*/}\[\e[m\e[0;31m:\e[0m"
# π¦ πΏ π² π π¦ π π¦ βΊ β° π π π₯
}
function vpn() {
if [ "$@" == "on" ]; then
loadvpn
echo "VPN enabled!"
else
unloadvpn
echo "VPN disabled!"
fi
}
function wifipassword() {
security find-generic-password -wa "$@"
}
# Git autocomplete
export PATH="$HOME/.fastlane/bin:$PATH"
if which swiftenv > /dev/null; then eval "$(swiftenv init -)"; fi
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi
#Move to git directory and check status
#cd ~/Developer/ios_core
git status