-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
258 lines (220 loc) · 10.5 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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
# =============================================================================
# Plugins
# =============================================================================
# Automagically quote URLs. This obviates the need to quote them manually when
# pasting or typing URLs.
autoload -Uz url-quote-magic
zle -N self-insert url-quote-magic
# =============================================================================
# Plugins
# =============================================================================
## Powerlevel10k settings, all theme related:
# powerlevel9k prompt theme
DEFAULT_USER=$USER
POWERLEVEL9K_MODE='nerdfont-complete'
#POWERLEVEL9K_SHORTEN_DIR_LENGTH=3
#POWERLEVEL9K_SHORTEN_STRATEGY="truncate_from_right"
POWERLEVEL9K_DIR_PATH_SEPARATOR="%F{cyan}/%F{blue}"
POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR=''
POWERLEVEL9K_RIGHT_SEGMENT_SEPARATOR=''
POWERLEVEL9K_LEFT_SUBSEGMENT_SEPARATOR=''
POWERLEVEL9K_RIGHT_SUBSEGMENT_SEPARATOR=''
POWERLEVEL9K_PROMPT_ON_NEWLINE=true
POWERLEVEL9K_RPROMPT_ON_NEWLINE=true
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX="%F{blue}\u256D\u2500%f"
POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX="%F{blue}\u2570\uf460%f "
POWERLEVEL9K_STATUS_OK=false
# These two configs determine what features appear on the left/write of your terminal
# the _joined suffix just moves them closer together so there isnt extra whitespace between them
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(user_joined anaconda_joined dir_joined
dir_writable_joined)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status command_execution_time vcs
background_jobs_joined time_joined
os_icon_joined host_joined)
POWERLEVEL9K_VCS_CLEAN_BACKGROUND="clear"
POWERLEVEL9K_VCS_CLEAN_FOREGROUND="green"
POWERLEVEL9K_VCS_MODIFIED_BACKGROUND="clear"
POWERLEVEL9K_VCS_MODIFIED_FOREGROUND="yellow"
POWERLEVEL9K_VCS_UNTRACKED_BACKGROUND="clear"
POWERLEVEL9K_VCS_UNTRACKED_FOREGROUND="yellow"
POWERLEVEL9K_DIR_HOME_BACKGROUND="clear"
POWERLEVEL9K_DIR_HOME_FOREGROUND="blue"
POWERLEVEL9K_DIR_HOME_SUBFOLDER_BACKGROUND="clear"
POWERLEVEL9K_DIR_HOME_SUBFOLDER_FOREGROUND="blue"
POWERLEVEL9K_DIR_WRITABLE_FORBIDDEN_BACKGROUND="clear"
POWERLEVEL9K_DIR_WRITABLE_FORBIDDEN_FOREGROUND="red"
POWERLEVEL9K_DIR_DEFAULT_BACKGROUND="clear"
POWERLEVEL9K_DIR_DEFAULT_FOREGROUND="cyan"
POWERLEVEL9K_ROOT_INDICATOR_BACKGROUND="clear"
POWERLEVEL9K_ROOT_INDICATOR_FOREGROUND="red"
POWERLEVEL9K_STATUS_OK_BACKGROUND="clear"
POWERLEVEL9K_STATUS_OK_FOREGROUND="green"
POWERLEVEL9K_STATUS_ERROR_BACKGROUND="clear"
POWERLEVEL9K_STATUS_ERROR_FOREGROUND="red"
POWERLEVEL9K_TIME_FORMAT="%D{\uf073 %b %d \uf017 %H:%M}" # Jun 15 09:32
POWERLEVEL9K_TIME_FOREGROUND="blue"
POWERLEVEL9K_TIME_BACKGROUND="clear"
POWERLEVEL9K_TIME_FOREGROUND="blue"
POWERLEVEL9K_COMMAND_EXECUTION_TIME_BACKGROUND='clear'
POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND='magenta'
POWERLEVEL9K_BACKGROUND_JOBS_BACKGROUND='clear'
POWERLEVEL9K_BACKGROUND_JOBS_FOREGROUND='magenta'
POWERLEVEL9K_USER_DEFAULT_BACKGROUND='clear'
POWERLEVEL9K_USER_DEFAULT_FOREGROUND='cyan'
POWERLEVEL9K_USER_ROOT_BACKGROUND='clear'
POWERLEVEL9K_USER_ROOT_FOREGROUND='red'
POWERLEVEL9K_USER_ICON="\uf415" #
POWERLEVEL9K_ROOT_ICON="\u26a1" # ⚡
POWERLEVEL9K_ROOT_ICON="\u2757" # ❗
POWERLEVEL9K_ALWAYS_SHOW_USER=true
POWERLEVEL9K_HOST_LOCAL_BACKGROUND='clear'
POWERLEVEL9K_HOST_LOCAL_FOREGROUND='cyan'
POWERLEVEL9K_HOST_REMOTE_BACKGROUND='clear'
POWERLEVEL9K_HOST_REMOTE_FOREGROUND='magenta'
POWERLEVEL9K_HOST_ICON="\uF109 " #
POWERLEVEL9K_SSH_ICON="\uF489 " #
POWERLEVEL9K_OS_ICON_BACKGROUND="clear"
POWERLEVEL9K_OS_ICON_FOREGROUND="grey"
POWERLEVEL9K_ANACONDA_BACKGROUND="clear"
POWERLEVEL9K_ANACONDA_FOREGROUND="blue"
POWERLEVEL9K_ANACONDA_SHOW_PYTHON_VERSION=false
POWERLEVEL9K_PYTHON_ICON="\uE73C" #
POWERLEVEL9K_ANACONDA_LEFT_DELIMITER=""
POWERLEVEL9K_ANACONDA_RIGHT_DELIMITER=""
### END Powerlevel10k
# zsh-syntax-highlighting settings
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern cursor)
ZSH_HIGHLIGHT_PATTERNS+=('rm -rf *' 'fg=white,bold,bg=red')
typeset -A ZSH_HIGHLIGHT_STYLES
ZSH_HIGHLIGHT_STYLES[path]='fg=blue'
ZSH_HIGHLIGHT_STYLES[path_pathseparator]='fg=cyan'
ZSH_HIGHLIGHT_STYLES[alias]='fg=cyan'
ZSH_HIGHLIGHT_STYLES[builtin]='fg=cyan'
ZSH_HIGHLIGHT_STYLES[function]='fg=cyan'
ZSH_HIGHLIGHT_STYLES[commandseparator]='fg=yellow'
ZSH_HIGHLIGHT_STYLES[redirection]='fg=magenta'
ZSH_HIGHLIGHT_STYLES[bracket-level-1]='fg=cyan,bold'
ZSH_HIGHLIGHT_STYLES[bracket-level-2]='fg=green,bold'
ZSH_HIGHLIGHT_STYLES[bracket-level-3]='fg=magenta,bold'
ZSH_HIGHLIGHT_STYLES[bracket-level-4]='fg=yellow,bold'
## zplug: plugin manager for zsh, so you don't have to manually install these :)
# Install if not already installed
if [[ ! -d "${ZPLUG_HOME}" ]]; then
if [[ ! -d ~/.zplug ]]; then
git clone https://github.com/zplug/zplug ~/.zplug
# If we can't get zplug, it'll be a very sobering shell experience. To at
# least complete the sourcing of this file, we'll define an always-false
# returning zplug function.
if [[ $? != 0 ]]; then
function zplug() {
return 1
}
fi
fi
export ZPLUG_HOME=~/.zplug
fi
if [[ -d "${ZPLUG_HOME}" ]]; then
source "${ZPLUG_HOME}/init.zsh"
fi
# These are our plugins. Most are self explanatory.
zplug 'plugins/colored-man-pages', from:oh-my-zsh
zplug 'plugins/git', from:oh-my-zsh, if:'which git'
zplug 'plugins/completion', from:oh-my-zsh # Additional autocompletions for zsh
zplug 'zsh-users/zsh-completions', defer:2 # Additional autocompletioins for zsh
# This is the theme itself, powerlevel10k (a faster/more efficient implementation of powerlevel9k)
zplug 'romkatv/powerlevel10k', use:powerlevel10k.zsh-theme
zplug 'zsh-users/zsh-autosuggestions'
zplug 'zsh-users/zsh-syntax-highlighting', defer:2
# Better directory colors
zplug 'seebi/dircolors-solarized', ignore:"*", as:plugin
# This plugin enables putting .autoenv.zsh files in directories, so you can run scripts when you cd into folders.
# eg. if you wanted to automatically run `conda activate fastai` when you switch to a fastai repo.
# This has been working inconsistently for me, so I'm commenting this out for now.
# zplug 'Tarrasch/zsh-autoenv'
# Install the plugins if not installed already
if ! zplug check; then
zplug install
fi
# source/load the plugins so they're active
zplug load
if zplug check 'seebi/dircolors-solarized'; then
if which gdircolors > /dev/null 2>&1; then
alias dircolors='gdircolors'
fi
if which dircolors > /dev/null 2>&1; then
scheme='dircolors.256dark'
eval $(dircolors $ZPLUG_HOME/repos/seebi/dircolors-solarized/$scheme)
fi
fi
if zplug check 'zsh-users/zsh-autosuggestions'; then
# Enable asynchronous fetching of suggestions.
ZSH_AUTOSUGGEST_USE_ASYNC=1
# For some reason, the offered completion winds up having the same color as
# the terminal background color (when using a dark profile). Therefore, we
# switch to gray.
# See https://github.com/zsh-users/zsh-autosuggestions/issues/182.
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=gray'
fi
## END zplug
# =============================================================================
# Options
# For default behaviour, you can turn off all of these setopt's
# =============================================================================
# Watching other users (hell if I know how this works, though - stolen from mavam/dotfiles)
WATCHFMT='%n %a %l from %m at %t.'
watch=(notme) # Report login/logout events for everybody except ourself.
LOGCHECK=60 # Time (seconds) between checks for login/logout activity.
REPORTTIME=5 # Display usage statistics for commands running > 5 sec.
WORDCHARS="\'*?_-.[]~=/&;!#$%^(){}<>\'"
# History
HISTFILE=~/.zsh_history
HISTSIZE=100000
SAVEHIST=100000
setopt autocd # Allow changing directories without `cd`
setopt append_history # Do not overwrite history
setopt extended_history # Also record time and duration of commands.
setopt share_history # Share history between multiple shells
setopt hist_expire_dups_first # Clear duplicates when trimming internal hist.
setopt hist_find_no_dups # Do not display duplicates during searches.
setopt hist_ignore_dups # Ignore consecutive duplicates.
setopt hist_ignore_all_dups # Remember only one unique copy of the command.
setopt hist_reduce_blanks # Remove superfluous blanks.
setopt hist_save_no_dups # Omit older commands in favor of newer ones.
# Changing directories (I don't fully understand what these options do, to be honest)
setopt pushd_ignore_dups # Do not push copies of the same dir on stack.
setopt pushd_minus # Reference stack entries with '-'.
setopt extended_glob
# Misc
setopt nobeep # Disable terminal bell
setopt autocd # cd if only a directory name was entered
# =============================================================================
# Aliases
# =============================================================================
# Directory coloring - alias `ls` to use the color flag which loads from a previously set env var.
if which gls > /dev/null 2>&1; then
# Prefer GNU version, since it respects dircolors.
alias ls='gls --group-directories-first --color=auto'
elif [[ $OSTYPE = (darwin|freebsd)* ]]; then
export CLICOLOR="YES" # Equivalent to passing -G to ls.
export LSCOLORS="exgxdHdHcxaHaHhBhDeaec"
else
alias ls='ls --group-directories-first --color=auto'
fi
# alert alias to let long-running commands send a notification when they're done :)
# eg. `alert sleep 10`
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
# =============================================================================
# Completions
# =============================================================================
# case-insensitive (all), partial-word and then substring completion
zstyle ':completion:*' matcher-list \
'm:{a-zA-Z}={A-Za-z}' \
'r:|[._-]=* r:|=*' \
'l:|=* r:|=*'
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
# When doing `cd ../<TAB>`, don't offer the current directory as an option.
zstyle ':completion:*:cd:*' ignore-parents parent pwd
# Show a menu (with arrow keys) to select the process to kill.
zstyle ':completion:*:*:kill:*' menu yes select
zstyle ':completion:*:kill:*' force-list always
################# END CONFIGS