-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
115 lines (95 loc) · 2.93 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
antibody bundle < ~/.zsh_plugins.txt > ~/.zsh_plugins.sh
#ANTIBODY_HOME="$(antibody home)"
#ZSH="$ANTIBODY_HOME/https-COLON--SLASH--SLASH-github.heygears.com-SLASH-robbyrussell-SLASH-oh-my-zsh"
export ZSH="/home/pvetere/.oh-my-zsh"
# Usage: prompt-length TEXT [COLUMNS]
function prompt-length() {
emulate -L zsh
local COLUMNS=${2:-$COLUMNS}
local -i x y=$#1 m
if (( y )) ; then
while (( ${${(%):-$1%$y(l.1.0)}[-1]} )) ; do
x=y
(( y *= 2 ));
done
local xy
while (( y > x + 1 )) ; do
m=$(( x + (y - x) / 2 ))
typeset ${${(%):-$1%$m(l.x.y)}[-1]}=$m
done
fi
echo $x
}
# Usage: fill-line LEFT RIGHT
function fill-line() {
emulate -L zsh
local left_len=$(prompt-length $1)
local right_len=$(prompt-length $2 9999)
local pad_len=$((COLUMNS - left_len - right_len + 1 - ${ZLE_RPROMPT_INDEX:-1}))
if (( pad_len < 1 )); then
# Not enough space for right part; drop it.
echo -E - ${1}
else
local pad=${(pl.$pad_len..$3.)}
echo -E - ${1}${pad}${2}
fi
}
function set-prompt() {
emulate -L zsh
local git_branch="$(git rev-parse --abbrev-ref HEAD 2>/dev/null)"
local frm_color=53
local dir_color=80
local frm_fmt="%F{$frm_color}"
local dir_fmt="%F{$dir_color}"
local cmd_fmt="%F{white}"
#local top_left="${frm_fmt}┌[${dir_fmt}%~${frm_fmt}]"
local top_left="${frm_fmt}─[${dir_fmt}%~${frm_fmt}]"
local top_right="${frm_fmt}[${dir_fmt}${git_branch}${frm_fmt}]─"
#local bot_left="${frm_fmt}│ %B%F{%(?.8.red)}%#%f%b "
local bot_left="${frm_fmt} %B%F{%(?.8.red)}%#%f%b "
PROMPT="$(fill-line "$top_left" "$top_right" "─" )"$'\n'$bot_left
}
autoload -Uz add-zsh-hook
add-zsh-hook precmd set-prompt
setopt noprompt{bang,subst} prompt{cr,percent,sp}
plugins=(
git
golang
kubectl
terraform
colored-man-pages
colorize
docker
emoji
npm
pip
pyenv
python
sudo
fd
zsh-autosuggestions
web-search
copypath
copyfile
dirhistory
#zsh_reload
)
source $ZSH/oh-my-zsh.sh
source ~/.alias_zshrc
if [ -z "${SSH_AUTH_SOCK}" ] ; then
eval `ssh-agent -s`
ssh-add
fi
eval "$(direnv hook zsh)"
export WASMTIME_HOME="$HOME/.wasmtime"
export PATH="$WASMTIME_HOME/bin:$PATH"
# Wasienv
export WASIENV_DIR="/home/pvetere/.wasienv"
[ -s "$WASIENV_DIR/wasienv.sh" ] && source "$WASIENV_DIR/wasienv.sh"
# Wasmer
export WASMER_DIR="/home/pvetere/.wasmer"
[ -s "$WASMER_DIR/wasmer.sh" ] && source "$WASMER_DIR/wasmer.sh"
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/home/pvetere/tmp/gcloud/google-cloud-sdk/path.zsh.inc' ]; then . '/home/pvetere/tmp/gcloud/google-cloud-sdk/path.zsh.inc'; fi
# The next line enables shell command completion for gcloud.
if [ -f '/home/pvetere/tmp/gcloud/google-cloud-sdk/completion.zsh.inc' ]; then . '/home/pvetere/tmp/gcloud/google-cloud-sdk/completion.zsh.inc'; fi