configs  Check-in [6e0de5152e]

Overview
Comment:Add zshrc.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 6e0de5152ee681fc8fd760f6b6eaaf1c89cb60806b6e2810fc271c25c0d562de
User & Date: js 2012-03-19 15:46:24
Context
2012-03-19
15:48
Add keyboard layout. check-in: c3eedb6659 user: js tags: trunk
15:46
Add zshrc. check-in: 6e0de5152e user: js tags: trunk
15:44
Initial import check-in: e895731002 user: js tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added 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
AUDIO_PLAYER="open"
VIDEO_PLAYER="open"
ARCHIVE_FORMATS=(7z bz2 gz tar tbz tbz2 tgz tar.gz tar.bz2 tar.xz rar xz zip)
AUDIO_PLAYER_FORMATS=(aac flac it m4a mod mp3 mpc ogg sid spc wma wv xm)
VIDEO_PLAYER_FORMATS=(avi divx flv mkv mov mpeg mp4 mpg ogm wmv)
EDITOR="/usr/local/bin/vim"
PAGER="less"
GREP=""
GREP_COLOUR="auto"
FGREP=""
FGREP_COLOUR="auto"
LS="gls"
LS_COLOUR="auto"
LS_ON_CD="yes"
LS_ON_INIT="no"
FEMALE="no"	# Whether the user is female ;)

if [ "$FEMALE" = "yes" ]; then
	PS1="%m:%c%B%(!.#.%{$(print "\e[1;35m")%}♥%{$(print "\e[0m")%})%b "
else
	PS1="%m:%c%B%(!.#.$)%b "
fi
PS2="%B>%b "
RPS1="%(1j.%{$(print "\e[1;33m")%}%j%{$(print "\e[0m")%}.)"
RPS1+="%(?..%(1j. .)%{$(print "\e[1;31m")%}%?%{$(print "\e[0m")%})"
RPS2="%(1_.%{$(print "\e[1;30m")%}(%_%)%{$(print "\e[0m")%}.)"
LISTMAX=32768
WORDCHARS="*?[];!#~"

bindkey -e
setopt no_bg_nice
setopt no_nomatch
setopt extended_glob
setopt autocd
setopt auto_pushd

autoload -U compinit
compinit -C

# Ignore case on completion
zstyle ':completion:*' matcher-list 'm:{A-Z}={a-z} m:{a-z}={A-Z}'

if [ "$GREP" -o "$GREP_COLOUR" ]; then
	[ -z "$GREP" ] && GREP="grep"
	[ ! -z "$GREP_COLOUR" -a "$GREP_COLOUR[1]" != "-" ] && \
		GREP_COLOUR="--colour=$GREP_COLOUR"
	alias grep="$GREP $GREP_COLOUR"
fi

if [ "$FGREP" -o "$FGREP_COLOUR" ]; then
	[ -z "$FGREP" ] && FGREP="fgrep"
	[ ! -z "$FGREP_COLOUR" -a "$FGREP_COLOUR[1]" != "-" ] && \
		FGREP_COLOUR="--colour=$FGREP_COLOUR"
	alias fgrep="$FGREP $FGREP_COLOUR"
fi

if [ "$LS" -o "$LS_COLOUR" ]; then
	[ -z "$LS" ] && LS="ls"
	[ ! -z "$LS_COLOUR" -a "$LS_COLOUR[1]" != "-" ] && \
		LS_COLOUR="--color=$LS_COLOUR"
	alias ls="$LS $LS_COLOUR"
fi

if [ "$LS_ON_CD" -a "$LS_ON_CD" != "no" ]; then
	chpwd() {
		ls
	}
fi

if [ "$TERM_PROGRAM" = "Apple_Terminal" ]; then
	update_terminal_cwd() {
		printf '\e]7;%s\a' "file://$HOSTNAME${PWD// /%20}"
	}
else
	update_terminal_cwd() {
	}
fi

case $TERM in
	aterm|Eterm|rxvt*|uxterm*|xterm*)
		# Use set_title if you want to change the term title
		set_title() {
			# Without this, precmd would override it
			precmd() {
				update_terminal_cwd
			}
			print -Pn "\e]0;$@\a"
		}

		unset_title() {
			precmd() {
				print -Pn "\e]0;%m\a"
				update_terminal_cwd
			}
		}

		unset_title
		;;
esac

alias vi="vim"

extr() {
	for i in $@; do
		case $i in
			*.7z)
				7za x $i
				;;
			*.tar)
				tar xfv $i
				;;
			*.tbz | *.tbz2 | *.tar.bz2)
				bzcat $i | tar xfv -
				;;
			*.tgz | *.tar.gz)
				gzcat $i | tar xfv -
				;;
			*.txz | *.tar.xz)
				xzcat $i | tar xfv -
				;;
			*.rar)
				unrar x $i
				;;
			*.zip)
				unzip $i
				;;
			# These have to be the last for obvious reasons
			*.bz2)
				bunzip2 $i
				;;
			*.gz)
				gunzip $i
				;;
			*)
				echo "$i: Unknown file type"
				false
				;;
		esac
	done
}

run_desktop()
{
	for i in $@; do
		$(grep -i "^exec=" $i | sed "s/^exec=//i")
	done
}

sprunge() {
	curl -F "sprunge=<-" http://sprunge.us
}

mencoder-iphone() {
	for i in "$@"; do
		mencoder -vf scale=480:-10,harddup -oac faac -faacopts mpeg=4:object=2:raw:br=128 -of lavf -lavfopts format=mp4 -ovc x264 -x264encopts nocabac:level_idc=30:bframes=0:global_header:threads=auto:subq=5:frameref=6:partitions=all:bitrate=800 -o "${i%.*}.iphone.m4v" "$i"
	done
}

for ext in $ARCHIVE_FORMATS; do alias -s $ext=extr; done

[ "$AUDIO_PLAYER" ] && \
	for ext in $AUDIO_PLAYER_FORMATS; do alias -s $ext=$AUDIO_PLAYER; done

[ "$VIDEO_PLAYER" ] && \
	for ext in $VIDEO_PLAYER_FORMATS; do alias -s $ext=$VIDEO_PLAYER; done

alias -s desktop=run_desktop
alias -s app=open

[ "$LS_ON_INIT" = "yes" ] && ls

unset AUDIO_PLAYER VIDEO_PLAYER
unset ARCHIVE_FORMATS AUDIO_PLAYER_FORMATS VIDEO_PLAYER_FORMATS
unset FGREP FGREP_COLOUR GREP GREP_COLOUR LS LS_COLOUR LS_ON_CD LS_ON_INIT
unset FEMALE