summaryrefslogtreecommitdiffstats
path: root/zshrc
blob: 0e1f3d849a3b8e953a8f64eb6c9e964b22295acd (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
# initialize zsh auto completion system
autoload -Uz compinit vcs_info; compinit
zmodload -i zsh/complist

# history settings
#HISTFILE=~/.histfile
SAVEHIST=0
HISTSIZE=1000

# no beep
setopt prompt_subst autocd
unsetopt beep

# sane keybindings
bindkey -e

# define colors
BLACK="%{"$'\033[01;30m'"%}"
GREEN="%{"$'\033[01;32m'"%}"
RED="%{"$'\033[01;31m'"%}"
YELLOW="%{"$'\033[01;33m'"%}"
BLUE="%{"$'\033[01;34m'"%}"
BOLD="%{"$'\033[01;39m'"%}"
NORM="%{"$'\033[00m'"%}"

# my prefered prompt with color
# %n = Username
# %m = Hostname
# %~ = Current Directory
# %# = Shell Icon % for User, # for root
PROMPT="${GREEN}%n@%m ${BLUE}%~ %# ${NORM}"

# VCS prompt on the right side
RPROMPT=$'$(vcs_info_wrapper)'

# enable color in some commands
eval "`dircolors -b`"
export LS_COLORS="$LS_COLORS*.wmv=01;35:"
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias less="less -r"

# shortcut for some commands
alias l=ls
alias gq="background geeqie"
alias ev="background evince"

# vim: open multiple files in tabs by default
alias vim="vim -p"

# improved calender
alias cal="ccal -e -f"

# use mplayer2 instead of mplayer
alias mplayer="mplayer2"

# connect to USB tty with 115200 baud
alias cusb="cu -l /dev/ttyUSB0 -s 115200"

# suffix aliases
alias -s jpg="background gpicview"
alias -s gif="background gpicview"
alias -s png="background gpicview"
alias -s svg="background gpicview"
alias -s pdf="background evince"
alias -s mkv="background mplayer2"
alias -s ogg="background mplayer2"
alias -s ogv="background mplayer2"
alias -s wmv="background mplayer2"
alias -s mpg="background mplayer2"
alias -s avi="background mplayer2"
alias -s mp4="background mplayer2"
alias -s exe="wine"
alias -s vala="vim"
alias -s txt="vim"
alias -s doc="oowriter"

# set default programs
if [ $TERM = "xterm" ] ; then
export TERM=xterm-256color
elif [ $TERM = "screen" ] ; then
export TERM=screen-256color
fi
export EDITOR=vim
export PAGER=vimpager
export BROWSER=chromium

# path /sbin for ifconfig etc.
export PATH=$PATH:/usr/sbin:/sbin:/var/lib/gems/1.8/bin

# function to set terminal title
title() {
      if [[ $TERM == "xterm" || $TERM == "xterm-256color" || $TERM == "rxvt" || $TERM == "screen" ]]; then
		print -Pn  "\e]2;$*\a"
      fi
}

# function to spawn a program in the background
background() {
	$1 $2 </dev/null >/dev/null 2>&1 &!
}

# get vcs info for the prompt
vcs_info_wrapper() {
	vcs_info
	echo "${vcs_info_msg_0_}"
}

# update title
function precmd { title "%n@%m %~" }

# menus for mutt and less
zstyle ':completion:*:*:less:*' menu yes select
zstyle ':completion:*:*:mutt:*' menu yes select

# menu for Processes
zstyle ':completion:*:*:*:*:processes' menu yes select
zstyle ':completion:*:*:*:*:processes' force-list always

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

# VCS Info
zstyle ':vcs_info:*' actionformats '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f '
zstyle ':vcs_info:*' formats '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{5}]%f '
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r'
zstyle ':vcs_info:*' enable git cvs svn

# export some variables
export EMAIL="sre@ring0.de"
export DEBEMAIL="sre@debian.org"
export DEBSIGN_MAINT="sre@debian.org"
export DEBCHANGE_RELEASE_HEURISTIC=changelog