summaryrefslogtreecommitdiff
path: root/zshrc
blob: 9300923f563c5429a627287f46bbf104ff0be6a7 (plain)
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
#export PATH="${PATH}:$HOME/src/arcanist/arcanist/bin"
#export ASAN_OPTIONS=abort_on_error=1
export CC="ccache gcc-4.8"
ulimit -c unlimited
alias j6='make -j -s'
alias j6='make -j6 -s V=0'
alias j='make -j -s'
alias gst='git status'
alias sst='svn status'
alias vg='valgrind --suppressions=~/.valgrind.supp --leak-check=full --show-reachable=yes --leak-resolution=high --track-origins=yes --num-callers=50'
alias vg2='valgrind --suppressions=~/.valgrind.supp --leak-check=full --show-reachable=no --leak-resolution=high --undef-value-errors=no --num-callers=50'
alias drd='valgrind --tool=drd --num-callers=40 --trace-children=yes'
alias kk='killall -9'
alias lh='ls -lh'
alias n='nano -xO'
alias m='schedtool -R -p 20 -e mplayer -fs -af volnorm -aspect 16:9 -monitoraspect 16:9'
alias aoeu='setxkbmap -layout us'
alias asdf='setxkbmap -layout dvorak'
alias ls='ls --color=auto'
alias sl='ls --color=auto'
alias ps='ps -e uf'
setterm -blank 0
alias df='df -h -x fuse.sshfs'
alias du='du -h'
alias sdu='du -sh'
alias grep='grep --color=auto'

#setopt promptsubst
#stty -tostop
fpath+=$HOME/.zsh/functions
export BROWSER="firefox"

cformat() {
	ecrustify -c ~/src/esvn/trunk/FORMATTING/ecrustify.cfg --replace $@
	sed -i 's/FOREACH (/FOREACH(/g;s/FREE (/FREE(/g;s/FOREACH_SAFE (/FOREACH_SAFE(/g' $@
}
hformat() {
	ecrustify -c ~/src/esvn/trunk/FORMATTING/ecrustify-headers.cfg --replace $@
	sed -i 's/FOREACH (/FOREACH(/g;s/FREE (/FREE(/g;s/FOREACH_SAFE (/FOREACH_SAFE(/g' $@
}

oprofile() {
#	opcontrol --no-vmlinux
	opcontrol --callgraph=7
	opcontrol --start
	opcontrol --dump
	opcontrol --reset
	$@
	opcontrol --stop
}

[[ -z "$terminfo[kdch1]" ]] || bindkey -M emacs "$terminfo[kdch1]" delete-char
[[ -z "$terminfo[khome]" ]] || bindkey -M emacs "$terminfo[khome]" beginning-of-line
[[ -z "$terminfo[kend]" ]] || bindkey -M emacs "$terminfo[kend]" end-of-line

#bindkey "^[[3~" delete-char
#bindkey '^[[7~' beginning-of-line
#bindkey '^[[8~' end-of-line 

if [ "$TERM" != "dumb" ]; then
    eval "`dircolors -b`"
fi

#export LANG="en_US.utf8"

# Colors
export red=$'%{\e[0;31m%}'
#export RED=$'%{\e[1;31m%}'
export green=$'%{\e[0;32m%}'
#export GREEN=$'%{\e[1;32m%}'
export blue=$'%{\e[0;34m%}'
#export BLUE=$'%{\e[1;34m%}'
export purple=$'%{\e[0;35m%}'
#export PURPLE=$'%{\e[1;35m}'
export cyan=$'%{\e[0;36m%}'
#export CYAN=$'%{\e[1;36m}'
#export WHITE=$'%{\e[1;37m}'
export white=$'%{\e[0;37m}'
export NC=$'%{\e[0m%}'

_force_rehash() {
  (( CURRENT == 1 )) && rehash
  return 1	# Because we didn't really complete anything
}

#Don't set a prompt if we aren't interactive
#This is the default prompt. It can be changed in a .rc file.
if [[ $- = *i* ]];then
  export RPROMPT="${cyan}(${NC}%30<...<%~%<<${cyan})${NC}"
  export PROMPT="${cyan}%t %n@%m%(!.${red}#${NC}.$)${NC} "
fi

HISTFILE=~/.zshhistory
HISTSIZE=30000
SAVEHIST=30000
LISTMAX=0

#if [[ -f $HOME/.ssh/known_hosts ]]; then
#  _sshhosts=( ${${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[0-9]*}%%\ *}%%,*}//[\[\]]/})
#fi
#if [[ -d $HOME/.subversion/auth/svn.simple/ ]];then
#        _svnfiles=(`find $HOME/.subversion/auth/svn.simple/`)
#        for i in ${_svnfiles[@]};do
#                _svnhosts+=( ${${${${(f)"$(<${i})"}:#[[:alnum:]]*}#*//}%:*} )
#        done
#fi
#unset _svnfiles
#_allhosts=($_sshhosts $_svnhosts)

#zstyle ':completion:*' hosts $_allhosts
zstyle ':completion:*' hosts off

# Expansion options
zstyle ':completion:*' completer _force_rehash _oldlist _expand \
 _complete _prefix
zstyle ':completion::prefix-1:*' completer _complete
zstyle ':completion:incremental:*' completer _complete _correct
zstyle ':completion:predict:*' completer _complete

# Completion caching
zstyle ':completion::complete:*' use-cache 1
zstyle ':completion::complete:*' cache-path ~/.zsh/cache/$HOST

# Expand partial paths
zstyle ':completion:*' expand 'yes'
zstyle ':completion:*' squeeze-slashes 'yes'

zstyle ':completion:*:*:*:users' ignored-patterns adm apache bin daemon games gdm halt ident junkbust named news nfsnobody nobody nscd ntp operator pcap rpc rpcuser rpm shutdown squid sshd sync uucp vcsa xfs adm alias at bin cron cyrus daemon ftp games gdm halt lp mail man mysql named news nobody nut operator portage postfix postgres postmaster qmaild qmaill qmailp qmailq qmailr qmails shutdown smmsp squid sshd sync uucp vpopmail xfs lp mail mailnull postgres radvd root sruk.fi

# Include non-hidden directories in globbed file completions
# for certain commands

zstyle ':completion::complete:*' '\'

#  tag-order 'globbed-files directories' all-files 
zstyle ':completion::complete:*:tar:directories' file-patterns '*~.*(-/)'

# Don't complete backup files as executables
zstyle ':completion:*:complete:-command-::commands' ignored-patterns '*\~'

# Separate matches into groups
zstyle ':completion:*:matches' group 'yes'

# Describe each match group.
zstyle ':completion:*:descriptions' format "%B---- %d%b"

# Messages/warnings format
zstyle ':completion:*:messages' format '%B%U---- %d%u%b' 
zstyle ':completion:*:warnings' format '%B%U---- no match for: %d%u%b'
 
# Describe options in full
zstyle ':completion:*:options' description 'yes'
zstyle ':completion:*:options' auto-description '%d'

# }}}
# {{{ Simulate my old dabbrev-expand 3.0.5 patch 

zstyle ':completion:*:history-words' stop verbose
zstyle ':completion:*:history-words' remove-all-dups yes
zstyle ':completion:*:history-words' list false

zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}

zstyle ':completion:*:*:kill:*' menu yes select
zstyle ':completion:*:kill:*' force-list always

#avoid partial globs
zstyle ':completion:*' accept-exact '*(N)'

#enable cache
zstyle ':completion:*' use-cache on
zstyle ':completion:*' cache-path ~/.zsh/cache

# zsh Options

setopt                       \
     NO_all_export           \
        always_last_prompt   \
     NO_always_to_end        \
        append_history       \
        auto_cd              \
        auto_list            \
        auto_menu            \
     NO_auto_name_dirs       \
        auto_param_keys      \
        auto_param_slash     \
        auto_pushd           \
        auto_remove_slash    \
     NO_auto_resume          \
        bad_pattern          \
        bang_hist            \
     NO_beep                 \
        brace_ccl            \
     NO_correct_all          \
     NO_bsd_echo             \
        cdable_vars          \
     NO_chase_links          \
     NO_clobber              \
     correct                 \
        csh_junkie_history   \
     NO_csh_junkie_loops     \
     NO_csh_junkie_quotes    \
     NO_csh_null_glob        \
        equals               \
        extended_glob        \
        extended_history     \
        function_argzero     \
        glob                 \
     NO_glob_assign          \
        glob_complete        \
     NO_glob_dots            \
        glob_subst           \
        hash_cmds            \
        hash_dirs            \
        hash_list_all        \
        hist_allow_clobber   \
        hist_beep            \
        hist_ignore_dups     \
        hist_ignore_space    \
     NO_hist_no_store        \
        hist_verify          \
     NO_hup                  \
        inc_append_history   \
     NO_ignore_braces        \
     NO_ignore_eof           \
        interactive_comments \
        list_ambiguous       \
     NO_list_beep            \
        list_types           \
        long_list_jobs       \
        magic_equal_subst    \
     NO_mail_warning         \
     NO_mark_dirs            \
     NO_menu_complete        \
        multios              \
        nomatch              \
        notify               \
     NO_null_glob            \
        numeric_glob_sort    \
     NO_overstrike           \
        path_dirs            \
        posix_builtins       \
     NO_print_exit_value     \
     NO_prompt_cr            \
        prompt_subst         \
        pushd_ignore_dups    \
     NO_pushd_minus          \
        pushd_silent         \
        pushd_to_home        \
        rc_expand_param      \
     NO_rc_quotes            \
     NO_rm_star_silent       \
     NO_share_history	     \
     NO_sh_file_expansion    \
        sh_option_letters    \
        short_loops          \
     NO_single_line_zle      \
     NO_sun_keyboard_hack    \
        unset                \
        zle
autoload zmv
# The following lines were added by compinstall
zstyle :compinstall filename '/root/.zshrc'

autoload -Uz compinit
compinit
# End of lines added by compinstall

source ~/src/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh