forked from geerlingguy/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.bash_profile
128 lines (110 loc) · 3.38 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
# Functions
# sourcef tests file exists, then sources to avoid throwing errors
function sourcef {
if [ -f "$1" ]
then
source $1
fi
}
# Bash
# use homebrew bash as login shell
shell_path=/usr/local/bin/bash
if [[ -f ${shell_path} && $BASH_VERSION == "3."* ]]; then
chsh -s ${shell_path} && echo Login shell updated to $(${shell_path} --version), relaunch.
fi
sourcef ${HOME}/.bashrc
# bash-completion (bash 3.x)
sourcef $(brew --prefix)/etc/bash_completion
# bash-completion@2 (bash 4.x)
sourcef $(brew --prefix)/share/bash-completion/bash_completion
## Longer history
export HISTSIZE=500
# aliases
alias duh="du -ahc"
alias ll="ls -laht"
alias vi="vim"
# options
set -o vi
# profile
sourcef .prompt_command
# Grep
export GREP_COLORS=auto
# FZF
sourcef ~/.fzf.bash
# Iterm2
sourcef ${HOME}/.iterm2_shell_integration.bash
# AWS CLI
#brew install remind101/formulae/assume-role
function makeme { env ASSUMED_ROLE=$1 $(which assume-role) $1 $SHELL -l; }
function pretendme { env ASSUMED_ROLE=$1 $SHELL -l; }
function whoamiaws { aws sts get-caller-identity; }
# ViM
#fix editor exiting 1
export EDITOR=/usr/bin/vim
# Gcloud
# stream last build logs
alias gblog='gcloud beta builds list --limit=1 --format=value\(extract\(id\)\) | xargs gcloud beta builds log --stream'
# Keybase
#use standalone keybase only
alias keybase='keybase --standalone'
# Git
alias gst='git status'
alias gd='git diff'
alias gdc='git diff --cached'
alias gc='git commit'
alias gcam='git commit -am '
alias gcm='git commit -m '
alias gca='git commit -a '
alias ga='git add'
alias gco='git checkout'
alias gb='git branch'
alias gl='git log --graph --pretty=format:"%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset" --abbrev-commit'
alias gm='git merge'
alias gp='git pull'
# fixws find files in the git repowith trailing whitespace. it's not perfect and might find things in commits which have already been fixed
fixws() {
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
# for FILE in `exec git diff-index --check --cached $against -- \
for FILE in `exec git diff --check $against -- \
| sed '/^[+-]/d' \
| sed -E 's/:[0-9]+:.*//' \
| uniq` ; do
# Fix them!
sed -i '' -E 's/[[:space:]]*$//' "$FILE"
echo "Fixed ws errors in $FILE"
done
}
# Perl
# By default non-brewed cpan modules are installed to the Cellar. Persist them across updates with local::lib
eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib=$HOME/perl5)"
# Python
#no more .pyc files
export PYTHONDONTWRITEBYTECODE=1
# Gcloud SDK
sourcef /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.bash.inc
sourcef /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.bash.inc
# icu4c unicode support library
export PATH="/usr/local/opt/icu4c/bin:$PATH"
export PATH="/usr/local/opt/icu4c/sbin:$PATH"
# sbin
export PATH="/usr/local/sbin:$PATH"
#GOLANG
export PATH=$PATH:/usr/local/opt/go/libexec/bin
export PATH=$PATH:$HOME/go/bin
export GOPATH=$HOME/go
#AWS-VAULT
#export PATH=$HOME/.aws/bin:$PATH
#AWSume alias to source the AWSume script
alias awsume="source awsume"
#Auto-Complete function for AWSume
_awsume() {
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts=$(awsume-autocomplete)
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
}
complete -F _awsume awsume