-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bashrc
88 lines (73 loc) · 3.43 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
# ALIASES #########################################################################################
alias ll='ls -la --color=always'
alias k='kubectl'
alias v='nvim'
if [ "$(uname -s)" == "Darwin" ]; then
# Use GNU core utilities
alias timeout=gtimeout
alias date=gdate
alias cp=gcp
fi
# NEOVIM ##########################################################################################
export PATH="$PATH:/opt/nvim-linux64/bin"
if command -v nvim &>/dev/null; then
export EDITOR="nvim"
fi
# SHELL PROMPT ####################################################################################
PS1='\[\e[33m\]\w \[\e[2m\]$(__git_ps1 "(%s)")\[\e[0m\]\n\$ '
source ~/.git-prompt.sh
# Directory colours
export LS_COLORS="di=0;33"
# HISTORY #########################################################################################
export HISTCONTROL=ignoredups
HISTTIMEFORMAT="%F %T "
# GO ##############################################################################################
export GOPATH=$HOME/go
export PATH="$PATH:${GOPATH}/bin:${GOROOT}/bin"
export PATH=$PATH:/usr/local/go/bin
if command -v brew &>/dev/null; then
export GOROOT="$(brew --prefix golang)/libexec"
fi
# HOMEBREW ########################################################################################
if command -v brew &>/dev/null; then
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
# K8s #############################################################################################
if command -v difft &>/dev/null; then
export KUBECTL_EXTERNAL_DIFF=difft # kube diff using Difftastic
fi
# kubectl autocomplete
if command -v brew &>/dev/null; then
source /opt/homebrew/Cellar/bash-completion@2/2.11/share/bash-completion/bash_completion
else
source ~/.kube/kubectl_autocompletion
fi
complete -o default -F __start_kubectl k
# NEOVIM ##########################################################################################
# export PATH="$PATH:/opt/nvim-linux64/bin"
export GIT_EDITOR="nvim"
# FUNCTIONS #######################################################################################
# Check certificates
function certp() {
if (($# == 0)); then
openssl x509 -in /dev/stdin -text -noout
else
openssl x509 -in $1 -text -noout
fi
}
# Usage:
# kubectl get secret <secret> -o json | jq -r '."data"."tls.crt"' | base64 -d | certp | rg Not
# CUSTOM COMMANDS #################################################################################
export PATH="$HOME/bin:$PATH"
export PATH="$HOME/.local/bin:$PATH"
# Open github page for current branch and dir
alias git-open='cur=$(pwd); base=$(basename `git rev-parse --show-toplevel`); open $(echo $(git config remote.origin.url | sed "s/git@\(.*\):\(.*\).git/ https:\/\/\1\/\2/")/tree/$(git symbolic-ref --quiet --short HEAD )${cur#*$base})'
# Delete current branch and update master
alias git-branch-delete='main=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@'); \
branch=$(git rev-parse --abbrev-ref HEAD); git checkout ${main}; git branch -D ${branch}; git pull;'
# Recreate current branch after fetching master
alias git-branch-reset='main=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@'); \
branch=$(git rev-parse --abbrev-ref HEAD); git checkout ${main}; git branch -D ${branch}; git pull; git checkout -b ${branch}'
# OTHER ###########################################################################################
# Spotify themes
export PATH=$PATH:$HOME/.spicetify