forked from ChristianLempa/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
89 lines (76 loc) · 2.58 KB
/
.zshrc
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
# Goto
[[ -s "/usr/local/share/goto.sh" ]] && source /usr/local/share/goto.sh
# NVM lazy load
if [ -s "$HOME/.nvm/nvm.sh" ]; then
[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion"
alias nvm='unalias nvm node npm && . "$NVM_DIR"/nvm.sh && nvm'
alias node='unalias nvm node npm && . "$NVM_DIR"/nvm.sh && node'
alias npm='unalias nvm node npm && . "$NVM_DIR"/nvm.sh && npm'
fi
# Fix Interop Error that randomly occurs in vscode terminal when using WSL2
fix_wsl2_interop() {
for i in $(pstree -np -s $$ | grep -o -E '[0-9]+'); do
if [[ -e "/run/WSL/${i}_interop" ]]; then
export WSL_INTEROP=/run/WSL/${i}_interop
fi
done
}
# Kubectl Functions
# ---
#
alias k="kubectl"
alias h="helm"
kn() {
if [ "$1" != "" ]; then
kubectl config set-context --current --namespace=$1
else
echo -e "\e[1;31m Error, please provide a valid Namespace\e[0m"
fi
}
knd() {
kubectl config set-context --current --namespace=default
}
ku() {
kubectl config unset current-context
}
# Colormap
function colormap() {
for i in {0..255}; do print -Pn "%K{$i} %k%F{$i}${(l:3::0:)i}%f " ${${(M)$((i%6)):#3}:+$'\n'}; done
}
# ALIAS COMMANDS
alias ls="exa --icons --group-directories-first"
alias ll="exa --icons --group-directories-first -l"
alias g="goto"
alias grep='grep --color'
alias cbp="code /home/xcad/obsidianvault/boilerplates"
alias cpr="code /home/xcad/obsidianvault/projects"
# find out which distribution we are running on
_distro=$(awk '/^ID=/' /etc/*-release | awk -F'=' '{ print tolower($2) }')
# set an icon based on the distro
case $_distro in
*kali*) ICON="ﴣ";;
*arch*) ICON="";;
*debian*) ICON="";;
*raspbian*) ICON="";;
*ubuntu*) ICON="";;
*elementary*) ICON="";;
*fedora*) ICON="";;
*coreos*) ICON="";;
*gentoo*) ICON="";;
*mageia*) ICON="";;
*centos*) ICON="";;
*opensuse*|*tumbleweed*) ICON="";;
*sabayon*) ICON="";;
*slackware*) ICON="";;
*linuxmint*) ICON="";;
*alpine*) ICON="";;
*aosc*) ICON="";;
*nixos*) ICON="";;
*devuan*) ICON="";;
*manjaro*) ICON="";;
*rhel*) ICON="";;
*) ICON="";;
esac
export STARSHIP_DISTRO="$ICON "
# Load Starship
eval "$(starship init zsh)"