-
Notifications
You must be signed in to change notification settings - Fork 1
/
macZsh
202 lines (161 loc) · 5.71 KB
/
macZsh
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
SCRIPT_PATH=${${(%):-%N}:A:h}
function addPath {
local -i prefix=$1
local dir=$2
if [[ -d "$dir" ]]; then
if [ $prefix -ne 0 ]; then
path+=("$dir")
else
path=("$dir" $path)
fi
fi
}
# These must be listed in the reverse order!
addPath 1 '/sbin'
addPath 1 '/usr/sbin'
addPath 1 '/usr/local/sbin'
addPath 1 '/bin'
addPath 1 '/usr/bin'
addPath 1 '/usr/local/bin'
addPath 1 "$HOME/go/bin"
addPath 1 "$HOME/bin"
addPath 1 "$HOME/.cargo/bin"
addPath 0 '/usr/bin/core_perl'
addPath 0 '/usr/bin/site_perl'
addPath 0 "$HOME/.gem/ruby/2.1.0/bin"
export PYENV_ROOT="$HOME/.pyenv"
addPath 1 "$PYENV_ROOT/bin"
eval "$(pyenv init -)"
export ZSH_AUTOSUGGEST_USE_ASYNC=1
export ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20
export DISABLE_MAGIC_FUNCTIONS=true
ZSH_AUTOSUGGEST_STRATEGY=(history completion)
function is_macos {
[[ $OSTYPE == darwin* ]] || return 1
}
function is_nix {
[[ $OSTYPE == linux* ]] || return 1
}
ZDOTDIR="$HOME/.antidote"
source "$ZDOTDIR/antidote.zsh"
antidote load $HOME/.antidoterc
# source $SCRIPT_PATH/antigen.zsh
# antigen init $HOME/.antigenrc
bindkey '^ ' autosuggest-accept
# Double quote single quotes to "escape" them inside a single-quoted string
setopt rcquotes
# Setup prompt
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
alias -g G='| rg'
alias -g Gi='| rg'
alias -g L='| bat'
alias -g LP='| bat -p'
alias -g LC='| wc -l'
alias -g WC='| wc -l'
alias -g UC='| sort | uniq -c | sort -rh'
# create a zkbd compatible hash;
# to add other keys to this hash, see: man 5 terminfo
typeset -g -A key
key[Home]="${terminfo[khome]}"
key[End]="${terminfo[kend]}"
key[Insert]="${terminfo[kich1]}"
key[Backspace]="${terminfo[kbs]}"
key[Delete]="${terminfo[kdch1]}"
key[Up]="${terminfo[kcuu1]}"
key[Down]="${terminfo[kcud1]}"
key[Left]="${terminfo[kcub1]}"
key[Right]="${terminfo[kcuf1]}"
key[PageUp]="${terminfo[kpp]}"
key[PageDown]="${terminfo[knp]}"
key[Shift-Tab]="${terminfo[kcbt]}"
# setup key accordingly
[[ -n "${key[Home]}" ]] && bindkey -- "${key[Home]}" beginning-of-line
[[ -n "${key[End]}" ]] && bindkey -- "${key[End]}" end-of-line
[[ -n "${key[Insert]}" ]] && bindkey -- "${key[Insert]}" overwrite-mode
[[ -n "${key[Backspace]}" ]] && bindkey -- "${key[Backspace]}" backward-delete-char
[[ -n "${key[Delete]}" ]] && bindkey -- "${key[Delete]}" delete-char
[[ -n "${key[Up]}" ]] && bindkey -- "${key[Up]}" up-line-or-history
[[ -n "${key[Down]}" ]] && bindkey -- "${key[Down]}" down-line-or-history
[[ -n "${key[Left]}" ]] && bindkey -- "${key[Left]}" backward-char
[[ -n "${key[Right]}" ]] && bindkey -- "${key[Right]}" forward-char
[[ -n "${key[PageUp]}" ]] && bindkey -- "${key[PageUp]}" beginning-of-buffer-or-history
[[ -n "${key[PageDown]}" ]] && bindkey -- "${key[PageDown]}" end-of-buffer-or-history
[[ -n "${key[Shift-Tab]}" ]] && bindkey -- "${key[Shift-Tab]}" reverse-menu-complete
# Finally, make sure the terminal is in application mode, when zle is
# active. Only then are the values from $terminfo valid.
if (( ${+terminfo[smkx]} && ${+terminfo[rmkx]} )); then
autoload -Uz add-zle-hook-widget
function zle_application_mode_start { echoti smkx }
function zle_application_mode_stop { echoti rmkx }
add-zle-hook-widget -Uz zle-line-init zle_application_mode_start
add-zle-hook-widget -Uz zle-line-finish zle_application_mode_stop
fi
# Interactive aliases
alias genSrc='mkdir -p src/{main,test}/{java,scala,resources} && touch src/{main,test}/{java,scala,resources}/.keep'
alias pssh='ssh -o PubkeyAuthentication=no'
BASH_COLORS="$SCRIPT_PATH/base16/scripts/base16-onedark.sh"
if [[ -f $BASH_COLORS ]]; then
source $BASH_COLORS
fi
if [[ -f "$HOME/.config/broot/launcher/bash/br" ]]; then
source "$HOME/.config/broot/launcher/bash/br"
fi
export RIPGREP_CONFIG_PATH="$SCRIPT_PATH/.ripgreprc"
which lsd >/dev/null 2>/dev/null
if [ $? -eq 0 ]; then
alias ls='lsd'
alias l='lsd'
alias la='lsd -a'
alias lla='lsd -la'
alias ll='lsd -l'
alias lld='lsd -l --total-size'
alias lt='lsd --tree'
alias llt='lsd -l --tree'
alias llta='lsd -la --tree'
else
alias ls='ls -h'
alias ll='ls -l'
alias la='ls -A'
alias l='ls -CF'
alias llx='ll -X'
alias lx='ls -X'
alias lla='ls -lA'
fi
BASH_COLORS="$SCRIPT_PATH/base16/scripts/base16-tomorrow-night-eighties.sh"
if [[ -f $BASH_COLORS ]]; then
source $BASH_COLORS
fi
# If we have custom things we need to setup, do that now
if [[ -f ~/.zsh_custom ]]; then
source ~/.zsh_custom
fi
__setupv() {
NAME=$1;shift
VERSION=$1;shift
pyenv virtualenv --clear --force "$VERSION" "$NAME"
pyenv shell "$NAME"
pyenv exec pip install -U pip setuptools wheel
pyenv exec pip install -U $@
pyenv shell normal
}
setupv() {
__setupv nvim3 3.11.5 colorama neovim "python-lsp-server[all]"
}
alias pyei='env MAKE_OPTS="-j12" \
env PYTHON_MAKE_INSTALL_OPTS="Make=gmake" \
env CONFIGURE_OPTS="--enable-shared --enable-optimizations --with-computed-gotos" \
env CFLAGS="-O2 -pipe" \
env CXXFLAGS="-O2 -pipe" \
pyenv install -v'
alias pyein='env MAKE_OPTS="-j12" \
env PYTHON_MAKE_INSTALL_OPTS="Make=gmake" \
env CONFIGURE_OPTS="--enable-shared --with-computed-gotos" \
env CFLAGS="-O2 -pipe" \
env CXXFLAGS="-O2 -pipe" \
pyenv install -v'
alias iatuin='RUSTFLAGS="-C target-cpu=native -C link-arg=-s" cargo install atuin --no-default-features --features client'
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
export SDKMAN_DIR="$HOME/.sdkman"
[[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"
eval "$(pyenv init -)"
alias iantidote='git clone --depth=1 https://github.com/mattmc3/antidote.git ${ZDOTDIR}'