-
Notifications
You must be signed in to change notification settings - Fork 3
/
zshrc
228 lines (155 loc) · 5.38 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
autoload zmv
autoload -U colors && colors
eval $( dircolors -b $HOME/.ls_colors/LS_COLORS )
export PYTHONSTARTUP="$HOME/.pythonrc"
export MANPAGER="vimmanpager"
export GDFONTPATH=/usr/share/fonts/ttf-bitstream-vera
export SDL_AUDIODRIVER=alsa
#{{{ PATH
# add user scripts to path
PATH="${HOME}/.scripts:${PATH}:"
# add user binaries to path
PATH="${HOME}/.bin:${PATH}:"
# add sbin to PATH so sudo can tab complete it
PATH="${PATH}:/sbin:/usr/sbin:"
PATH="${HOME}/eagle-5.10.0/bin:${PATH}:"
# altera
PATH="/opt/altera/quartus/bin:${PATH}:"
PATH="/media/other/opt/altera/nios2eds/bin/gnu/H-i686-pc-linux-gnu/bin:${PATH}:"
PATH="/media/other/opt/altera/nios2eds/sdk2/bin/:${PATH}:"
PATH="/media/other/opt/altera/nios2eds/bin/:${PATH}:"
PATH="/media/other/opt/altera/nios2eds/:${PATH}:"
#}}}
#{{{ Tab completion
autoload -Uz compinit && compinit
# color partial completions
zstyle -e ':completion:*:default' list-colors 'reply=("${PREFIX:+=(#bi)($PREFIX:t)(?)*==34=0}:${(s.:.)LS_COLORS}")';
# tab complete known hosts
hosts=(`sed 's/\[\|\]\| .*//g;s/,/\n/g;s/:.*$//g' ~/.ssh/known_hosts | sort | uniq | tr '\n' ' '`)
zstyle ':completion:*:hosts' hosts $hosts
# case insensitive completion
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
# kill tab completion
zstyle ':completion:*:processes-names' command 'ps -e -o comm='
zstyle ':completion:*:processes' command 'ps -au$USER'
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;32'
# completion options
setopt COMPLETE_IN_WORD
#}}}
#{{{ Aliases
alias ssh_server='ssh pwner@durknation.gotdns.com -p69'
alias ssh_router='ssh admin@router'
alias ssh_home='ssh user@bear24rw.pw -p 44'
alias ssh_ucfilespace='ssh thrunml@ucfilespace.uc.edu'
alias ssh_uceng='ssh thrunml@virtulab.ceas1.uc.edu '
alias ssh_tv='ssh media@192.168.1.111'
alias ssh_desktop='ssh user@192.168.1.137 -p44'
alias mount_server='sshfs -p69 -o reconnect -o follow_symlinks pwner@durknation.gotdns.com:/ ~/mnt/server'
alias mount_home='sshfs -p44 -o reconnect -o follow_symlinks user@bear24rw.pw:/ ~/mnt/backup'
alias mount_desktop='sshfs -p44 -o reconnect -o follow_symlinks user@192.168.1.137:/ ~/mnt/desktop'
alias mount_ucfilespace='sshfs -o reconnect -o follow_symlinks thrunml@ucfilespace.uc.edu:/Network/Servers/ucfilespace.uc.edu/Home/t/thrunml/ ~/mnt/ucfilespace'
alias mount_uceng='sshfs -o reconnect -o follow_symlinks thrunml@virtulab.ceas1.uc.edu:/home/thrunml/ ~/mnt/uceng'
alias ls='ls --group-directories-first --color=auto -X -h --classify'
alias ll='ls -l'
alias lla='ll -a'
alias rrsync='rsync -av --stats --progress'
alias grep='grep --color'
alias egrep='egrep --color'
alias df='df -h'
alias watch='watch -n1 -d --color'
alias lsdir='for dir in *;do;if [ -d $dir ];then;du -hsL $dir 2>/dev/null;fi;done'
alias locate='locate -i'
alias lower='tr "[:upper:]" "[:lower:]"'
alias upper='tr "[:lower:]" "[:upper:]"'
alias back='popd'
alias nowrap='cut -c -$COLUMNS'
alias ydl='youtube-dl -t'
alias magic='magic -dOGL -T/home/user/school/vlsi/models/SCN3ME_SUBM.30.tech27'
#}}}
#{{{ Options
# don't cycle through completions
setopt BASH_AUTO_LIST
setopt NO_AUTO_MENU
# cd=pushd
setopt AUTO_PUSHD
setopt PUSHD_SILENT
# regex like globbing: cp ^*.(tar|bz2|gz)
setopt EXTENDED_GLOB
# dont error if glob cant be expanded
unsetopt nomatch
# don't beep
setopt NO_BEEP
# emacs keybindings
setopt EMACS
# disable ctrl-s (breaks rtorrent)
setopt NO_FLOW_CONTROL
# = is needed for emerge
unsetopt EQUALS
# case insensitive globbing
setopt NO_CASE_GLOB
#}}}
#{{{ Key bindings
# home / end keys
bindkey '\e[1~' beginning-of-line
bindkey '\e[4~' end-of-line
bindkey '' vi-forward-word
bindkey '' vi-backward-word
bindkey '' vi-backward-char
bindkey '' vi-forward-char
bindkey '' history-incremental-pattern-search-backward
# control+j is hard mapped to line feed?
#bindkey ' ' down-history
bindkey '' up-history
#}}}
#{{{ History
HISTFILE=~/.history
SAVEHIST=500000
HISTSIZE=500000
# write after each command
setopt INC_APPEND_HISTORY
# share history between multiple shells
setopt SHARE_HISTORY
setopt HIST_IGNORE_DUPS
# remove superfluous blanks
setopt HIST_REDUCE_BLANKS
# don't store if command begins with a space
setopt HIST_IGNORE_SPACE
setopt HIST_NO_STORE
# don't execute a history expansion, just show it
setopt HIST_VERIFY
h() { if [ -z "$*" ]; then history 1; else history 1 | egrep "$@"; fi; }
#}}}
#{{{ VCS info in PS1
# http://briancarper.net/blog/570/git-info-in-your-zsh-prompt
# execute commands in PS1
setopt PROMPT_SUBST
autoload -Uz vcs_info
zstyle ':vcs_info:*' stagedstr ' +'
zstyle ':vcs_info:*' unstagedstr ' *'
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{11}%r'
zstyle ':vcs_info:*' enable git svn
zstyle ':vcs_info:*' formats '%F{yellow}(%b%c%u%F{yellow}) '
#}}}
#{{{ Terminal title
function title_job() {
if [[ $TERM == 'screen'* ]]; then
print -Pn "\ek${1//\\/\\\\}\e\\"
else
print -Pn "\e]0;${1//\\/\\\\}\a"
fi
}
function title_path() {
if [[ $TERM == 'screen'* ]]; then
print -Pn "\ek%~\e\\"
else
print -Pn "\e]0;%n@%m: %~\a"
fi
}
# set the intial title
title_path
#}}}
precmd() { vcs_info; title_path; }
preexec() { title_job $1; }
[ -n "$SSH_CLIENT" ] && prompt_color=cyan || prompt_color=green
PROMPT='%B%(!.%F{red}.%F{${prompt_color}})%n@%m %B%F{blue}%~ ${vcs_info_msg_0_}%F{blue}%# %b%f%k'