-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrc
More file actions
106 lines (89 loc) · 3.15 KB
/
rc
File metadata and controls
106 lines (89 loc) · 3.15 KB
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
#!/bin/bash
export DOTS=~/dots
export LANG=en_GB.UTF-8
export LC_ALL=en_GB.UTF-8
shell_in_use=$(ps -o args= -p "$$")
if [[ $shell_in_use =~ "zsh" ]]; then
PS1="%1~ $ "
if [[ "$(uname)" =~ "Darwin" ]]; then
# Enable Option+arrow key bindings for word jumping
bindkey -e
bindkey '^[[1;3D' backward-word # Option+left arrow
bindkey '^[[1;3C' forward-word # Option+right arrow
elif [[ "$(uname)" =~ "Linux" ]]; then
# Enable Ctrl+arrow key bindings for word jumping
bindkey '^[[1;5D' backward-word # Ctrl+left arrow
bindkey '^[[1;5C' forward-word # Ctrl+right arrow
fi
elif [[ $shell_in_use =~ "bash" ]]; then
PS1="\W $ "
fi
# Custom commands
export PATH="${DOTS}/bin:${PATH}"
# Custom sourced commands
for file in "$DOTS/source-bin/"*; do
if [ -f "$file" ]; then
# shellcheck disable=SC1090
source "$file"
fi
done
# Make the command line have Vi functionality
# set -o vi
# General Aliases
alias spy='watch ' # Gets watch to support aliases with spy
alias ll='ls -lh'
alias la='ls -lah'
alias vi='vim'
# Git
git config --global core.excludesfile $DOTS/config-files/.gitignore
git config --global core.editor vim
git config --global core.eol lf
git config --global core.ignorecase true
git config --global gpg.program gpg
git config --global pull.rebase false
git config --global init.defaultBranch main
git config --global push.autoSetupRemote true
GPG_TTY=$(tty)
export GPG_TTY
if [[ "$(uname)" =~ "Darwin" ]]; then
git config --global credential.helper osxkeychain # Permanent cache
elif [[ "$(uname)" =~ "Linux" ]]; then
git config --global credential.helper 'cache --timeout=86400' # 24 hour cache
fi
# Kubectl
alias k='kubectl'
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
alias kx='kubectl ctx'
alias portargo='kubectl -n argocd port-forward svc/argo-cd-argocd-server 9999:80'
export USE_GKE_GCLOUD_AUTH_PLUGIN=True
# Google Cloud SDK
export GOOGLE_CLOUD_SDK=$(mise where gcloud)
if [[ $shell_in_use =~ "zsh" ]]; then
if [ -f "$GOOGLE_CLOUD_SDK/path.zsh.inc" ]; then source "$GOOGLE_CLOUD_SDK/path.zsh.inc"; fi
if [ -f "$GOOGLE_CLOUD_SDK/completion.zsh.inc" ]; then source "$GOOGLE_CLOUD_SDK/completion.zsh.inc"; fi
elif [[ $shell_in_use =~ "bash" ]]; then
if [ -f "$GOOGLE_CLOUD_SDK/path.bash.inc" ]; then source "$GOOGLE_CLOUD_SDK/path.bash.inc"; fi
if [ -f "$GOOGLE_CLOUD_SDK/completion.bash.inc" ]; then source "$GOOGLE_CLOUD_SDK/completion.bash.inc"; fi
fi
alias gala='gcloud auth login --update-adc'
# Android SDK & Platform Tools
if [[ "$(uname)" =~ "Darwin" ]]; then
export ANDROID_HOME="$HOME/Library/Android/sdk"
elif [[ "$(uname)" =~ "Linux" ]]; then
export ANDROID_HOME="$HOME/Android/Sdk"
fi
export PATH="$ANDROID_HOME/platform-tools:$PATH"
# Python / Pip
export PIP_REQUIRE_VIRTUALENV=true
# mise-en-place for installing languages and SDKs
if test -f "$HOME/.local/bin/mise"; then
if [[ $shell_in_use =~ "zsh" ]]; then
eval "$("$HOME"/.local/bin/mise activate zsh)"
elif [[ $shell_in_use =~ "bash" ]]; then
eval "$("$HOME"/.local/bin/mise activate bash)"
fi
fi
# VisualVM Java JDK on MacOS
if [[ "$(uname)" =~ "Darwin" ]]; then
alias visualvm='visualvm_jdkhome=$JAVA_HOME/Contents/Home /Applications/VisualVM.app/Contents/MacOS/visualvm'
fi