-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathzshrc.main
216 lines (169 loc) · 5.2 KB
/
zshrc.main
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
source ~/.env
#
# ZSH Setup
#
## Completion ##
setopt AUTO_LIST
setopt AUTO_MENU
setopt NONOMATCH
setopt COMPLETEINWORD EXTENDEDGLOB
autoload -Uz compinit && compinit
zstyle ':completion:*' menu select
zstyle ':completion:*' list-colors ''
## History ##
HISTFILE=~/.zsh_history
HISTSIZE=1500 # history items kept internally
SAVEHIST=1500 # history items saved
setopt SHARE_HISTORY # share history between sessions
setopt HIST_FCNTL_LOCK # use OS file locking
setopt HIST_IGNORE_SPACE # Don't record commands entered starting with a space
setopt HIST_IGNORE_DUPS # don't store immediate dups
setopt HIST_NO_STORE # don't store fc/history commands
setopt HIST_REDUCE_BLANKS # canonicalize whitespace
setopt HIST_VERIFY # pause to edit ! item
stty -ixon # Disable flow-control so C-s works
## Prompt ##
autoload -Uz colors && colors
autoload -Uz promptinit && promptinit && prompt bart
PROMPT="%189>..>%{%F{red}%}%n@%m%b%f%k%9(v. . %{%F{blue}%}%(?.[.%20(?.[%U.%S[))%7v%(?.].%20(?.%u].]%s))%b%f%k )%{%F{default}%}%8~%b%f%k%<<%8v%174(l. . %{%F{default}%}%D%b%f%k)%182(l.. %{%F{red}%}%@%b%f%k)%9(v.
%{%F{blue}%}%(?.[.%20(?.[%U.%S[))%7v%(?.].%20(?.%u].]%s))%b%f%k.)
%# "
autoload -z edit-command-line
zle -N edit-command-line
bindkey "^X^E" edit-command-line
## Navigation ##
setopt AUTO_PUSHD
setopt CDABLE_VARS
## Extras ##
autoload -Uz zmv # Batch move and rename
alias zmv='noglob zmv'
#
# Configuration
#
export RIPGREP_CONFIG_PATH="${HOME}/.ripgreprc"
#
# Custom tools and aliases
#
function napropos () {
npm run | grep $1 -A 1
}
alias nr='npm run'
alias g='git'
alias v='nvim'
alias vim='nvim'
alias l='ls'
alias mtime='stat -f "%Sm" -t "%Y-%m-%d %H:%M:%S"'
function zarv() {
time "$@"
EXIT_CODE="$?"
say -v "Zarvox" "'$1' Process Finished: Exit code $EXIT_CODE"
return $EXIT_CODE
}
function cac() {
DIRS="$(find ~/code-primary -name "$(echo "$*" | tr ' ' '*')*" -maxdepth 1 -type d)"
echo "$DIRS"
echo -n ':'
read -k 1 LNO
DIR="$(sed -n "$LNO p" <<<"$DIRS")"
cd "$DIR"
v .
}
# Change directory to what Finder is looking at:
# Via https://twitter.com/QuinnyPig/status/1473112091808591874
cdf() {
target=`osascript -e 'tell application "Finder" to get POSIX path of (target of front Finder window as text)'`
cd "$target"
}
alias vsetup='( cd ~/code-personal/dot-files/ && v ./setup.sh && ./setup.sh )'
alias vzshrc='v ~/code-personal/dot-files/zshrc.main && source ~/code-personal/dot-files/zshrc.main'
alias vzshrcl='v ~/.zshrc && source ~/.zshrc'
#
# A8C Specific (non-sensitive):
#
alias wpcom-rsync="rsync -az --delete --delete-after \
--exclude '.config' \
--exclude '.svn' \
--exclude '.git' \
--exclude 'node_modules' \
--exclude '.settings' \
--exclude 'wp-content/themes' \
--exclude 'wp-content/languages' \
--exclude '*.png' \
--exclude '*.jpeg' \
--exclude '*.jpg' \
--exclude '*.gif' \
--exclude '*.mp3' \
--exclude '*.mov' \
--exclude '*.wav' \
--exclude '*.tiff' \
--exclude '.tags.*' \
--exclude '.tags*' \
--exclude '.tags' \
--info=progress2"
function mcpull () {
wpcom-rsync wpcom-sandbox:/home/missioncontrol/public_html/ ~/code-primary/missioncontrol-00/
}
function mcpush () {
wpcom-rsync ~/code-primary/missioncontrol-00/ wpcom-sandbox:/home/missioncontrol/public_html/
}
function wppull () {
wpcom-rsync wpcom-sandbox:/home/wpcom/public_html/ ~/code-primary/wpcom-00/
}
function wppush () {
wpcom-rsync ~/code-primary/wpcom-00/ wpcom-sandbox:/home/wpcom/public_html/
}
# Uploads any modified file to your sandbox
function wpwatch () {
# path to your local copy of public_html folder
WORKDIR=~/code-primary/wpcom
SANDBOX="wpcom-sandbox"
echo "Watching for changes on $WORKDIR"
start=0
current_OS=`uname`
if [[ $current_OS == "Darwin" ]]; then
fswatch -x $WORKDIR |
while read filepath flag1 flag2 flag3 flag4; do
now="$(date +"%s")"
if (( now-start > 2 )); then
relpath=${filepath#"$WORKDIR"}
echo "Uploading $relpath ... "
scp $filepath $SANDBOX:~/public_html$relpath
start="$(date +"%s")"
fi
done
else
inotifywait -rm $WORKDIR -e create,modify,move |
while read path action file; do
now="$(date +"%s")"
if (( now-start > 2 )); then
relpath=${path#"$WORKDIR"}
echo "Uploading $relpath$file ... "
scp $path$file $SANDBOX:~/public_html$relpath$file
start="$(date +"%s")"
fi
done
fi
}
function gst () {
echo "-------------------"
for P in ~/code-primary/"$1"*; do
echo "# $P:"
git --git-dir="$P/.git" --work-tree="$P" status
echo "-------------------"
done
}
function gc () {
REPO="$1" && \
N="${"${2}":-0}" && \
pushd ~/code-primary/$REPO*-0$N/ && \
update_terminal_cwd
}
function gv () {
REPO="$1" && \
N="${"${2}":-0}" && \
pushd ~/code-primary/$REPO*-0$N/ && \
update_terminal_cwd && \
vim .
}
HADOOP_PROXY_DOCKER_RUN_EXTRA_ARGS="--mount type=bind,src="${HOME}/.bash_aliases",dst=/home/remote-user/.bash_aliases,readonly"
PIPENV_CMD="pipx run pipenv"