-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
210 lines (169 loc) · 4.8 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
209
210
preexec() {
timer=$(($(date +%s%0N)/1000000))
}
preexec
HISTFILE=~/.local/share/zsh_history
HISTSIZE=100000
SAVEHIST=100000
setopt hist_expire_dups_first
setopt hist_ignore_all_dups
setopt hist_ignore_dups
setopt hist_ignore_space
setopt inc_append_history
setopt prompt_subst
setopt share_history
setopt hist_verify
setopt NO_HUP
setopt correct
#
# COMPLETIONS
#
typeset -gaU fpath=($fpath ~/.local/share/zsh/completions)
typeset -gaU fpath=($fpath ~/.local/share/kde-builder/data/completions/zsh/)
zstyle :compinstall filename "$HOME/.zshrc"
local zdump="$HOME/.cache/zdump"
zmodload zsh/zutil
zmodload zsh/complist
eval "$(dircolors)"
zstyle ':completion:*' rehash true
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cmd'
zstyle ':completion:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
zstyle ':completion:*' menu select
zstyle ':completion::*' use-cache 'true'
zstyle ':completion::*' cache-path "$HOME/.cache"
# compile completion
autoload -Uz bashcompinit compinit
compinit -d "$zdump"
bashcompinit
if [[ ! "${zdump}.zwc" -nt "$zdump" ]]
then
zcompile "$zdump"
fi
unset zdump
if [ -f ~/.shell_aliases ]; then
. ~/.shell_aliases
fi
#
# BINDINGS
#
bindkey '\e[1~' beginning-of-line # Linux console
bindkey '\e[H' beginning-of-line # xterm
bindkey '\eOH' beginning-of-line # gnome-terminal
bindkey '\e[2~' overwrite-mode # Linux console, xterm, gnome-terminal
bindkey '\e[3~' delete-char # Linux console, xterm, gnome-terminal
bindkey '\e[4~' end-of-line # Linux console
bindkey '\e[F' end-of-line # xterm
bindkey '\eOF' end-of-line # gnome-terminal
bindkey -M emacs '^[[3;5~' kill-word #gnome-terminal and xterm
bindkey -M emacs '^[[3^' kill-word #urxvt
autoload -U select-word-style
select-word-style bash
bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word
# edit the command line with $EDITOR
autoload -z edit-command-line
zle -N edit-command-line
bindkey "^X^E" edit-command-line
#
# PROMPT
#
setopt prompt_subst
autoload -Uz vcs_info
zstyle ':vcs_info:*' actionformats \
'%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f '
zstyle ':vcs_info:*' formats \
'%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{5}]%f '
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r'
zstyle ':vcs_info:*' enable git
precmd() {
if [ $timer ]; then
local now=$(date +%s%3N)
local d_ms=$(($now-$timer))
local d_s=$((d_ms / 1000))
local ms=$((d_ms % 1000))
local s=$((d_s % 60))
local m=$(((d_s / 60) % 60))
local h=$((d_s / 3600))
if ((h > 0)); then elapsed=${h}h${m}m
elif ((m > 0)); then elapsed=${m}m${s}s
elif ((s >= 10)); then elapsed=${s}.$((ms / 100))s
elif ((s > 0)); then elapsed=${s}.$((ms / 10))s
else elapsed=${ms}ms
fi
psvar[1]=$elapsed
unset timer
fi
vcs_info
}
if [[ $TERM == "xterm-256color" ]]; then
pink="#ff87ff"
blue="#1C98F3"
white="#ffffff"
else
pink="magenta"
blue="blue"
white="white"
fi
PROMPT_EXIT_CODE="%F{$white}%K{$blue}[%?]%F{$blue}%K{$pink}"
PROMPT_CLOCK="%F{$white}🕛%v%K{$white}%F{$pink}"
PROMPT_USERNAME="%n%F{$white}%K{$pink}"
PROMPT_HOSTNAME="%K{$pink}%m%F{$pink}%K{$blue}"
PROMPT_PATH="%F{$white}%~%f%F{$blue}%k"
PROMPT_PROMPT="%K{$pink}%F{$white}%#%k%F{$pink}%k%f"
PROMPT="${PROMPT_EXIT_CODE}${PROMPT_CLOCK}${PROMPT_USERNAME}${PROMPT_HOSTNAME}${PROMPT_PATH}"' ${vcs_info_msg_0_}'"
${PROMPT_PROMPT}"
unset PROMPT_EXIT_CODE
unset PROMPT_CLOCK
unset PROMPT_USERNAME
unset PROMPT_HOSTNAME
unset PROMPT_PATH
unset pink
unset blue
unset white
#
# PLUGINS
#
loadPlugin() {
plugin="/usr/share/zsh/plugins/$1/$1.zsh"
if [[ -f $plugin ]]; then
source $plugin;
fi
}
loadPlugin zsh-syntax-highlighting
loadPlugin zsh-autosuggestions
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=#999'
#
# ENV VARS
#
addToPath() {
if [ -d "$1" ]; then
export PATH="$1:$PATH"
fi
}
export PAGER="most -w"
export EDITOR=vim
# compiler stuff
export CC="clang"
export CXX="clang++"
# export CFLAGS="-fcolor-diagnostics"
# export CXXFLAGS="$CFLAGS"
export LDFLAGS="-fuse-ld=mold"
export CMAKE_EXPORT_COMPILE_COMMANDS=1
export CMAKE_COLOR_DIAGNOSTICS=1
export CMAKE_GENERATOR="Kate"
# export QMAKESPEC=linux-clang
export RUSTUP_HOME="$HOME/.local/share/rustup"
export CARGO_HOME="$HOME/.local/share/cargo"
export CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
# npm stuff
export NODE_PATH="$HOME/.local/lib/node_modules:$NODE_PATH"
export npm_config_prefix="$HOME/.local"
export PNPM_HOME="$HOME/.local/share/pnpm"
# path
addToPath "$HOME/.local/bin"
addToPath "/usr/lib/ccache/bin"
addToPath "$PNPM_HOME"
addToPath "$HOME/.deno/bin"
precmd