-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc_shared
97 lines (83 loc) · 2.3 KB
/
.zshrc_shared
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
#!/usr/bin/env zsh
#shellcheck shell=bash disable=2034,2206,2086,1091
ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="robbyrussell"
KEYTIMEOUT=1
DISABLE_AUTO_TITLE=true
DISABLE_MAGIC_FUNCTIONS=true
IS_MACOS=$(uname -s | grep -c "darwin")
if [ $IS_MACOS -eq 1 ]; then
BREW_PREFIX="/usr/local"
else
BREW_PREFIX="/home/linuxbrew/.linuxbrew"
fi
export PYENV_ROOT="$HOME/.pyenv"
PATHS=(
$HOME/bin
$HOME/go/bin
$HOME/.yarn/bin
$HOME/.local/bin
$HOME/.luarocks/bin
$HOME/.cargo/bin
$HOME/.dotnet/tools
$BREW_PREFIX/bin
$BREW_PREFIX/sbin
$PYENV_ROOT/bin
/usr/local/bin
/usr/local/sbin
/usr/local/go/bin
/snap/bin
/usr/local/opt/{grep,coreutils,findutils}/libexec/gnubin
)
for i in "${PATHS[@]}"; do
[[ -d "$i" ]] && [[ ! $PATH == *"$i"* ]] && PATH="$i:$PATH"
done
# enable bash completion in zsh
autoload -U +X bashcompinit && bashcompinit
if [[ -z $plugins ]]; then
plugins=(
azure
rust
git
tmux
autojump
evalcache
web-search
zsh-vi-mode
zsh-autosuggestions
zsh-syntax-highlighting
)
fi
source $ZSH/oh-my-zsh.sh
unset PATHS
unset plugins
# 3rd party completions
command -v kubectl >/dev/null 2>&1 && _evalcache kubectl completion zsh
command -v argo >/dev/null 2>&1 && _evalcache argo completion zsh
command -v gh >/dev/null 2>&1 && _evalcache gh completion -s zsh
command -v direnv >/dev/null 2>&1 && _evalcache direnv hook zsh
command -v fnm >/dev/null 2>&1 && _evalcache fnm env --use-on-cd --shell zsh
command -v fnm >/dev/null 2>&1 && eval "$(fnm env --use-on-cd --shell zsh)"
command -v az >/dev/null 2>&1 && source $BREW_PREFIX/etc/bash_completion.d/az
command -v pyenv >/dev/null 2>&1 && eval "$(pyenv init -)"
alias vi="nvim"
alias cls="clear"
alias td="todo.sh"
alias k="kubectl"
alias x="exit"
complete -F __start_kubectl k
# auto suggestion tab accept word
# bindkey '\t' vi-forward-word
export TODO_DIR=$HOME/.todo
colortest() {
curl -sSLk -H "Cache-Control: no-cache, no-store" https://gist.githubusercontent.com/pwang2/77450beffe2d343c6c446a33a6df74f0/raw\?t=$(date +%s) | bash
}
strongpass() {
if [[ $(uname) == "Darwin" && -x "$(command -v pbcopy)" ]]; then
openssl rand -base64 14 | pbcopy
elif [[ $(uname) == "Linux" && -x "$(command -v xclip)" ]]; then
openssl rand -base64 14 | xclip -selection clipboard
else
openssl rand -base64 14
fi
}