summaryrefslogtreecommitdiffstats
path: root/zsh/zshrc
blob: a3fa06116f1fd7ddc4bd5261bb9ca249619de64f (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
#w
#w
#PUSER=%{$(echo -n '\e[0;37m')%}%n
#PATKI=%{$(echo -n '\e[0;37m')%}@
#PHOST=%{$(echo -n '\e[1;33m')%}%m
#PDOPP=%{$(echo -n '\e[1;37m')%}:
#PPATH=%{$(echo -n '\e[1;30m')%}%~
#PCOMM=%{$(echo -n '\e[0;37m')%}

#PROMPT="$PUSER$PATKI$PHOST$PDOPP$PPATH$PCOMM "

PROMPT="%~%(1v.%F{green}%1v%f.) %% "

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

setopt nobeep
setopt autocd
setopt listpacked
setopt listtypes
setopt append_history
setopt share_history

export PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/games:~/etc/bin/
export EMAIL=xeno@thehappy.de
export DEBEMAIL=xeno@thehappy.de
export DEBFULLNAME="Stefan Ritter"
export QUILT_PATCHES=debian/patches
export QUILT_REFRESH_ARGS="-p ab --no-timestamps --no-index"

HISTSIZE=1000
SAVEHIST=1000
HISTFILE=~/.zsh_history

autoload -U compinit; compinit
autoload zmv
autoload -Uz vcs_info
precmd() {
	psvar=()
	vcs_info
	[[ -n $vcs_info_msg_0_ ]] && psvar[1]="$vcs_info_msg_0_"
}

alias c="clear && fortune"

alias ls="ls --color=auto"
alias l="ls -lah"
alias mkdir="mkdir -p"
alias rmrf="rm -rf"
alias v="vim"

alias g='git'
alias gee='geeqie'
alias gitserv="git daemon --verbose --reuseaddr --base-path=. --export-all ./.git"
alias iso="genisoimage -l -J -R -o cd.iso"
alias m="mocp"
alias p="pal -r 7"
alias q='quilt'
alias r="rdesktop-vrdp -k de -K localhost"
alias s="screen -r -d"
alias t="tmux a"
alias tmux='tmux -u'
alias vbm="VBoxManage"

alias agu="sudo aptitude update"
alias agdu="sudo aptitude dist-upgrade"
alias acs="apt-cache search"
alias agi="sudo aptitude install"
alias as="aptitude show"
alias purge="sudo apt-get --purge autoremove"

alias svn-uscan='uscan --verbose --force-download --rename --repack --destdir=../tarballs'
alias svn-bp='svn-buildpackage --svn-builder=pdebuild --svn-ignore-new'
alias gendebpool='dpkg-scanpackages -m . /dev/null | gzip -9c > Packages.gz'
alias git-bp='git-buildpackage --git-ignore-new --git-tarball-dir=/home/xeno/debian/tarballs/ --git-upstream-branch=upstream --git-debian-branch=master --git-builder=pdebuild --debbuildopts "-i"'
alias sfnv='uscan --verbose --no-symlink --rename'

alias -g C='| wc -l'
alias -g G='| grep'
alias -g H='| head'
alias -g T='| tail'
alias -g L='| less'

alias -s jpg=geeqie

shot() {
	if [ "$1" != '' ]; then
		scrot -c -d 3 $1
		scp $1 xeno:www/pub/
		rm $1
	else
		scrot -c -d 3
	fi
}

md() {
	mkdir $1
	cd $1
}


case $TERM in
	rxvt*)
    		precmd () {print -Pn "\e]0;%n@%m: %~\a"}
	;;
esac

cp_p()
{
   strace -q -ewrite cp -- "${1}" "${2}" 2>&1 \
      | awk '{
        count += $NF
            if (count % 10 == 0) {
               percent = count / total_size * 100
               printf "%3d%% [", percent
               for (i=0;i<=percent;i++)
                  printf "="
               printf ">"
               for (i=percent;i<100;i++)
                  printf " "
               printf "]\r"
            }
         }
         END { print "" }' total_size=$(stat -c '%s' "${1}") count=0
}

fip() {
	SUBNET=""
	if [[ $1 =~ ^[a-z][0-9][0-9][0-9]$ ]]; then
		if [ "$(echo $1 | cut -c 1)" = "a" ]; then
			SUBNET='amber'
		elif [ "$(echo $1 | cut -c 1)" = "b" ]; then
			SUBNET='blue'
		elif [ "$(echo $1 | cut -c 1)" = "c" ]; then
			SUBNET='cyan'
		elif [ "$(echo $1 | cut -c 1)" = "g" ]; then
			SUBNET='green'
		elif [ "$(echo $1 | cut -c 1)" = "i" ]; then
			SUBNET='indigo'
		elif [ "$(echo $1 | cut -c 1)" = "j" ]; then
			SUBNET='jade'
		elif [ "$(echo $1 | cut -c 1)" = "k" ]; then
			SUBNET='khaki'
		elif [ "$(echo $1 | cut -c 1)" = "l" ]; then
			SUBNET='lemmon'
		elif [ "$(echo $1 | cut -c 1)" = "m" ]; then
			SUBNET='magenta'
		elif [ "$(echo $1 | cut -c 1)" = "o" ]; then
			SUBNET='orange'
		elif [ "$(echo $1 | cut -c 1)" = "p" ]; then
			SUBNET='purple'
		elif [ "$(echo $1 | cut -c 1)" = "r" ]; then
			SUBNET='red'
		elif [ "$(echo $1 | cut -c 1)" = "s" ]; then
			SUBNET='silver'
		elif [ "$(echo $1 | cut -c 1)" = "u" ]; then
			SUBNET='umbra'
		elif [ "$(echo $1 | cut -c 1)" = "w" ]; then
			SUBNET='white'
		elif [ "$(echo $1 | cut -c 1)" = "y" ]; then
			SUBNET='yellow'
		else
			echo "Error: Unknown subnet"
		fi

		if [ $SUBNET ]; then
			ping $1.$SUBNET.fastwebserver.de | grep from
		fi
	else
		echo "Syntax error: need char + 3 integer!"
	fi
}

cd ~/