-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
209 lines (168 loc) · 5.45 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
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
203
204
205
206
207
208
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# If you come from bash you might have to change your $PATH.
export PATH=$HOME/bin:"$HOME"/.local/bin:$PATH
#export TERM=xterm-256color
# Path to your oh-my-zsh installation.
export ZSH=~/.oh-my-zsh
export FZF_BASE=~/.fzf/
export FZF_COMPLETION_TRIGGER='€€'
export GOPATH=$HOME/go
# Brew
export HOMEBREW_NO_ANALYTICS=1
# Reverse search path to look for brew bin last
# eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
export HOMEBREW_PREFIX="/home/linuxbrew/.linuxbrew";
export HOMEBREW_CELLAR="/home/linuxbrew/.linuxbrew/Cellar";
export HOMEBREW_REPOSITORY="/home/linuxbrew/.linuxbrew/Homebrew";
export PATH="${PATH:+$PATH:}/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin";
export MANPATH="$(manpath -g):/home/linuxbrew/.linuxbrew/share/man";
export INFOPATH="${INFOPATH:+$INFOPATH:}/home/linuxbrew/.linuxbrew/share/info";
if type brew &>/dev/null; then
FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH
autoload -Uz compinit
compinit
fi
# Krew
export PATH="${PATH}:${HOME}/.krew/bin"
export PATH="$HOME/.cargo/bin:$PATH" # Cargo install
export PATH="$HOME/go/bin:$PATH"
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
# ZSH_THEME="pygmalion"
ZSH_THEME="powerlevel10k/powerlevel10k"
DISABLE_AUTO_UPDATE="true"
plugins=(
autojump
git
gh
vi-mode
sudo
docker
kubectl
kube-ps1
golang
bgnotify
rust
pip
fzf
systemd
minikube
taskwarrior
terraform
)
source $ZSH/oh-my-zsh.sh
HISTSIZE=10000000
SAVEHIST=10000000
unsetopt BEEP
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
export EDITOR='nvim'
bindkey -M viins 'jk' vi-cmd-mode
bindkey "^[b" backward-word
bindkey "^[f" forward-word
# Make less display 5 lines of context before search match
export LESS=-j5
export DOCKER_BUILDKIT=1
function tw () {
command timew "$@" && py3-cmd refresh timewarrior
}
# aliases
alias apl='sudo -E apt update && sudo apt list --upgradable'
alias apu='sudo -E apt upgrade'
alias api='sudo -E apt install'
alias aps='sudo -E apt search'
alias wiki='vim -c VimwikiIndex'
alias yga='yadm add'
alias ygc='yadm commit'
alias ygp='yadm push'
alias ygst='yadm status'
alias tz='task project:zenika'
alias twmo='tw modify start'
alias twme='tw modify end'
alias tws='tw summary :ids'
alias twsy='tw summary yesterday :ids'
alias twsw='tw summary :week :ids'
alias twspw='tw summary sopw - eopw :ids'
alias twsm='tw summary :month :ids'
alias icat='kitty +kitten icat'
alias plantuml='docker run -i --rm plantuml-docker plantuml'
alias vim='nvim'
# functions
reset_vpn() {
sudo pkill openvpn
sudo pkill orange-vpn-watc
sudo nmcli device delete tap5
}
# Background command notification format. Plugin bgnotify
function bgnotify_formatted {
## $1=exit_status, $2=command, $3=elapsed_time
bgnotify "$2 returned $1 after $3 s";
}
enable_secondary_screen() {
if [[ $1 == "only" ]]; then
xrandr --output eDP-1 --off --output DP-1 --auto
else
xrandr --output eDP-1 --auto --output DP-1 --auto --right-of eDP-1
fi
}
disable_secondary_screen() {
xrandr --output eDP-1 --primary --auto --output DP-1 --off
}
search_and_replace() {
matched_files=$(grep -R "$1" -l)
declare -a matched_files_array
while read -r file
do
matched_files_array+=($file)
done <<< "$matched_files"
for file in $matched_files_array; do
echo "$file"
# Start vim without plugins in search/replace mode
vim -u NONE -c "%s/$1/$2/gc" -c "wq" "$file";
done
}
vp() {
file=$(fzf --preview 'bat --style=numbers --color=always {}')
if [[ $file != "" ]]; then
vim $file
fi
}
WT() {
while true;
do
$*
done
}
WTS() {
local SLEEP=$1
shift
while true;
do
$*
sleep $SLEEP
done
}
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
PATH="/home/gfeun/perl5/bin${PATH:+:${PATH}}"; export PATH;
PERL5LIB="/home/gfeun/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB;
#PERL_LOCAL_LIB_ROOT="/home/gfeun/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT;
#PERL_MB_OPT="--install_base \"/home/gfeun/perl5\""; export PERL_MB_OPT;
#PERL_MM_OPT="INSTALL_BASE=/home/gfeun/perl5"; export PERL_MM_OPT;
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
export PATH=/home/gfeun/google-cloud-sdk/bin/:$PATH
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/home/gfeun/google-cloud-sdk/path.zsh.inc' ]; then . '/home/gfeun/google-cloud-sdk/path.zsh.inc'; fi
# The next line enables shell command completion for gcloud.
if [ -f '/home/gfeun/google-cloud-sdk/completion.zsh.inc' ]; then . '/home/gfeun/google-cloud-sdk/completion.zsh.inc'; fi
#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 "$(starship init zsh --print-full-init)"