-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
274 lines (204 loc) · 7.81 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
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# With great thanks and credit to Paradigm and his wonderfully crafted .zshrc
# https://github.com/paradigm/dotfiles/blob/master/.zshrc
# Lines configured by zsh-newuser-install, minus those also set by Paradigm
HISTFILE=~/.history
HISTSIZE=10000
SAVEHIST=10000
setopt appendhistory
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
#zstyle :compinstall filename '/home/embo/.zshrc'
# autocompletion?
autoload -Uz compinit
compinit
# End of lines added by compinstall
# ==============================================================================
# = auto startx
# ==============================================================================
[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx
# ==============================================================================
# = general settings =
# ==============================================================================
# cd into directory just by directory name
setopt autocd
# prompt to correct typos
setopt correct
# don't propose _shellfunctions when correcting
CORRECT_IGNORE='_*'
# additional glob options
setopt extendedglob
# shut up
setopt nobeep
# don't change nice for bg tasks
setopt nobgnice
# Disable flow control. Specifically, ensure that ctrl-s does not stop
# terminal flow so that it can be used in other programs (such as Vim).
setopt noflowcontrol
stty -ixon
# Do not kill background processes when closing the shell.
setopt nohup
# Do not warn about closing the shell with background jobs running.
setopt nocheckjobs
# don't record repeated things in history
setopt histignoredups
# allows comments in commands
setopt interactivecomments
# consider / a word break, for ctrl-w
WORDCHARS=${WORDCHARS//\/}
# vi mode
bindkey -v
# ==============================================================================
# = completion =
# ==============================================================================
# $fpath defines where Zsh searches for completion functions. Include one in
# the $HOME directory for non-root-user-made completion functions.
#fpath=(~/.zsh/completion $fpath)
# Zsh's completion can benefit from caching. Set the directory in which to
# load/store the caches.
CACHEDIR="$HOME/.zsh/$(uname -n)"
# Use completion functionality.
autoload -U compinit
compinit -d $CACHEDIR/zcompdump 2>/dev/null
# cache, speed things up
zstyle ':completion:*' use-cache on
# Set the cache location.
zstyle ':completion:*' cache-path $CACHEDIR/cache
# If the <tab> key is pressed with multiple possible options, print the
# options. If the options are printed, begin cycling through them.
zstyle ':completion:*' menu select
# Print the catagories the completion options fit into.
zstyle ':completion:*:descriptions' format '%U%B%d%b%u'
# Set format for warnings
zstyle ':completion:*:warnings' format 'Sorry, no matches for: %d%b'
# Use colors when outputting file names for completion options.
zstyle ':completion:*' list-colors ''
# Do not prompt to cd into current directory.
# For example, cd ../<tab> should not prompt current directory.
zstyle ':completion:*:cd:*' ignore-parents parent pwd
# When using history-complete-(newer/older), complete with the first item on
# the first request (as opposed to 'menu select' which only shows the menu on
# the first request)
zstyle ':completion:history-words:*' menu yes
bindkey '^[[Z' reverse-menu-complete
# ==============================================================================
# = functions and zle widgets =
# ==============================================================================
#
# ------------------------------------------------------------------------------
# - zle widgets -
# ------------------------------------------------------------------------------
#
# The ZLE widges are all followed by "zle -<MODE> <NAME>" and bound below in
# the "Key Bindings" section.
# Prepend "sudo" to the command line if it is not already there.
prepend-sudo() {
if ! echo "$BUFFER" | grep -q "^sudo "
then
BUFFER="sudo $BUFFER"
CURSOR+=5
fi
}
zle -N prepend-sudo
# Prepend "vim" to the command line if it is not already there.
prepend-vim() {
if ! echo "$BUFFER" | grep -q "^vim "
then
BUFFER="vim $BUFFER"
CURSOR+=5
fi
}
zle -N prepend-vim
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# other custom functions
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# cd into a directory then immediately ls
cds() {
cd $1 && ls
}
brb() {
slock & sudo pm-suspend;
}
capstone-dev() {
cd $HOME/capstone/mypharmacist-web;
source venv/bin/activate
}
# ==============================================================================
# = key bindings =
# ==============================================================================
# temporarily save line contents
bindkey "^Y" push-line
# prepend sudo
bindkey "^S" prepend-sudo
# prepend vim
bindkey "^V" prepend-vim
# ==========================================================================
# environmental variables
# ==========================================================================
#
# ------------------------------------------------------------------------------
# - general (evironmental variables) -
# ------------------------------------------------------------------------------
# "/bin/zsh" should be the value of $SHELL if this config is parsed. This line
# should not be necessary, but it's not a bad idea to have just in case.
export SHELL="/bin/zsh"
# Set the default text editor.
export EDITOR="vim"
if [[ -z $DISPLAY ]]; then
export BROWSER="elinks"
else
export BROWSER="firefox"
fi
# If in a terminal that can use 256 colors, ensure TERM reflects that fact.
if [ "$TERM" = "xterm" ]
then
export TERM="xterm-256color"
elif [ "$TERM" = "screen" ]
then
export TERM="screen-256color"
fi
# set PDF reader
export PDFREADER="evince"
export PDFVIEWER="evince"
# Set the default image viewer.
export IMAGEVIEWER="google-chrome"
# sets mail directory
export MAIL="~/.mail"
export TZ="America/New_York"
# ------------------------------------------------------------------------------
# - prompt (environmental variables) -
# ------------------------------------------------------------------------------
#
autoload -U colors && colors
if [[ "$EUID" == "0" ]]; then
export PROMPT="%{$fg_bold[blue]%}[%{$fg_bold[red]%}%n%{$reset_color%}@%{$fg[green]%}%m%{$fg_bold[blue]%}] [%{$reset_color%}%{$fg[green]%}%~%{$fg_bold[blue]%}]%{$reset_color%}
# "
else
export PROMPT="%{$fg_bold[blue]%}[%{$fg_bold[green]%}%n%{$reset_color%}%{$fg[green]%}@%m%{$fg_bold[blue]%}] [%{$reset_color%}%{$fg[green]%}%~%{$fg_bold[blue]%}]%{$reset_color%}
\$ "
#export PROMPT=$'%{\e[0;36m%}%n@%m:%~'\$$'%{\e[0m%} '
fi
# ==============================================================================
# = aliases =
# ==============================================================================
# ------------------------------------------------------------------------------
# - new commands (aliases) -
# ------------------------------------------------------------------------------
# Clear the screen then run `ls`
alias cls="clear;ls"
# Search entire filesystem and ignore errors
#alias finds="find / -name 2>/dev/null"
# Take ownership of file or directory
#alias mine="sudo chown -R $(whoami):$(whoami)"
# allow others to read/execute
#alias yours="sudo find . -perm -u+x -exec chmod a+x {} \; && sudo find . -perm -u+r -exec chmod a+r {} \;"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# set default flags
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
alias ls="ls --color=auto -h --group-directories-first"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# wumbo
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
export wumbo=1
# rbenv
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"