-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbashrc
98 lines (78 loc) · 2.68 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
set -o vi
RED=`tput setaf 1`
GREEN=`tput setaf 2`
YELLOW=`tput setaf 3`
RESET=`tput sgr0`
# export PS1="\u@\h \w$ "
export PS1="\[${GREEN}\]\w\[${RESET}\] \[${YELLOW}\]\$(parse_git_branch)\[${RESET}\]$ "
export PATH=$PATH:$HOME/bin:$HOME/go/bin:$HOME/google-cloud-sdk/bin/
export GOOGLE_APPLICATION_CREDENTIALS=$HOME/code/sample-projects/interop-clusters/z/gke-creds.json
export CLICOLOR=YES # For macOS
export EDITOR=vim
export CSCOPE_EDITOR=vim
export GOPATH=$HOME/go
export GOBIN=$GOPATH/bin
# System params
HISTSIZE=500000
alias v='vim'
alias c='clear'
alias rm='rm -iv'
alias ff='find . -name'
alias cp='cp -iv'
alias mv='mv -iv'
alias xterm='xterm -bg white -fg black -fa 'Monospace''
alias ctags='ctags -RV --file-tags=yes'
# alias gotags='gotags -R . > tags'
# alias cscope='cscope -RC'
alias s='git status -s'
alias d='git diff'
alias b='git branch'
alias gl='git log --all --graph'
alias python='python3'
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
fi
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
# Some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
#alias notes='vim ~/code/2775/hansrajd_notes.md'
alias notes='vim ~/code/a69309f1244d55e770683d935ca7d934/notes.md'
alias sre='vim ~/code/2947/sre_troubleshooting_guide.md'
alias dbs='vim ~/code/sample-projects/dbs-tmc.txt'
# Set options
shopt -s extglob
# Completion files
source $HOME/git-completion.bash
source $HOME/completion.bash
source $HOME/key-bindings.bash
alias g='fd -H -t f --exclude={z,tags,.git,cscope.files,cscope.out} | xargs grep --color=auto -ni $1'
alias gw='fd -H -t f --exclude={z,tags,.git,cscope.files,cscope.out} | xargs grep --color=auto -nw $1'
# function g() {
# grep -nri --color=auto "$1" .
# }
# function gg() {
# grep -nri --include=\*.{go,py,c,h,cpp,js,tf,json,sh,html,env,yml,yaml} --color=auto "$1" .
# }
parse_git_branch() {
git branch 2> /dev/null | grep "\*" | cut -d " " -f2
}
# K8s
source <(kubectl completion bash) # setup autocomplete in bash into the current shell, bash-completion package should be installed first.
alias k=kubectl
# alias kg='kubectl get --sort-by='metadata.creationTimestamp''
alias kg='kubectl get'
complete -F __start_kubectl k
get_cluster_name() {
kubectl config view | grep "cluster: " | cut -d ":" -f2 | xargs
}
get_namespace() {
kubectl config view | grep "namespace: " | cut -d ":" -f2 | xargs
}
alias kk='echo cluster: "${RED}$(get_cluster_name)${RESET} namespace: ${RED}$(get_namespace)${RESET}"'
alias dlv=/Users/hansrajd/go/bin/dlv