removing outdated emacs files (soon to be replaced with recent ones)
[srid.dotfiles.git] / dot-zshrc
bloba022012a0633058bbc982eff0f27e6fb0e7af37e
1 source /etc/profile
3 # Load the super duper completion stuff
4 autoload -Uz compinit
5 compinit
7 autoload zmv
9 # Exports
10 export EDITOR="emacsclient"
11 export BROWSER="swiftfox"
12 export MEDIA="gmplayer"
14 # Aliases
15 alias md="mkdir"
16 alias ...="../.."
17 alias clean="rm *\~"
18 alias du="du -shc"
19 alias df='df -h'
20 alias e=$EDITOR
22 # Setting HOME and END keys
23 case $TERM in (xterm*|aterm|rxvt|screen)
24     bindkey '\e[H' beginning-of-line
25     bindkey '\e[F' end-of-line ;;
26 esac
28 # Key bindings, useful.
29 if [ $TERM = linux ]; then
30     bindkey "\e[3~" delete-char
31     bindkey "\e[2~" yank        #insert
32     bindkey "\e[1~" beginning-of-line
33     bindkey "\e[4~" end-of-line
34     bindkey "\e[5~" history-search-backward
35     bindkey "\e[6~" history-search-forward
36 else
37     bindkey "\e[3~" delete-char
38     bindkey "\e[2~" yank        #insert
39     bindkey "\e[7~" beginning-of-line
40     bindkey "\e[8~" end-of-line
41     bindkey "\e[5~" history-search-backward
42     bindkey "\e[6~" history-search-forward
45 # History things
46 HISTFILE=$HOME/.zshistory
47 SAVEHIST=3000
48 HISTSIZE=3000
50 # Colours
52 # I haven't actually used these yet, apart from for reference. You can use
53 # these when prompting. Capitalised stuff is bold.
55 local red="%{"$'\e[1;31m'"%}"
56 local RED="%{"$'\e[0;31m'"%}"
57 local cyan="%{"$'\e[1;36m'"%}"
58 local CYAN="%{"$'\e[0;36m'"%}"
59 local blue="%{"$'\e[1;34m'"%}"
60 local BLUE="%{"$'\e[0;34m'"%}"
61 local green="%{"$'\e[1;32m'"%}"
62 local GREEN="%{"$'\e[0;32m'"%}"
63 local magenta="%{"$'\e[1;35m'"%}"
64 local MAGENTA="%{"$'\e[0;35m'"%}"
65 local yellow="%{"$'\e[1;33m'"%}"
66 local YELLOW="%{"$'\e[0;33m'"%}"
67 local gray="%{"$'\e[1;30m'"%}"
68 local GRAY="%{"$'\e[0;37m'"%}"
69 local white="%{"$'\e[1;37m'"%}"
70 local NOCOLOR="%{"$'\e[0m'"%}"
71 local NEWLINE="%{"$'\e[80D'"%}"
73 # Prompt
75 #PROMPT=$'%{\e[0;36m%}%n@%m%{\e[0;36m%}%{\e[0;37m%}::%{\e[0;30m%} '
76 #PROMPT="${CYAN}%D{%H:%M:%S} ${GREEN}%#${GRAY}]$NOCOLOR "
77 #PROMPT="${CYAN}%D{`pwd`} ${GREEN}%#${GRAY}]$NOCOLOR "
78 #RPROMPT="${GRAY}[${red}%.${GRAY}]$NOCOLOR"
79 PROMPT="$ "
80 RPROMPT="${GRAY}[${red}%15<...<%~${GRAY}]$NOCOLOR"
83 # Set the titlebar for the window, and also the window title in screen :)
85 # I don't want to be cocky, but this is all my own stuff and I'm frikking
86 # proud of it.
88 # This function sets the window tile to user@host:/workingdir before each
89 # prompt. If you're using screen, it sets the window title (works
90 # wonderfully for hardstatus lines :)
91 #precmd () {
92   [[ -t 1 ]] || return
93   case $TERM in
94       *xterm*|rxvt|urxvt|rxvt-unicode)
95           print -Pn "\e]2;%n@%m:%~\a"
96           ;;
97       screen*) print -Pn "\e\"%m:%~\e\134"
98   esac
101 # This sets the window title to the last run command.
102 precmd () {
103 [[ -t 1 ]] || return
104 case $TERM in
105     *xterm*|rxvt|urxvt|rxvt-unicode)
106         preexec () {
107             print -Pn "\e]2;$1\a"
108         }
109         ;;
110     screen*)
111         preexec () {
112             print -Pn "\e\"$1\e\134"
113         }
114         ;;
115 esac
118 # Some useful little functions
119 # Make mount easier
120 function mnt()
122     DRIVE=/mnt/$1
123 #    mount $DRIVE && cd $DRIVE && echo "${DRIVE} mounted."
124     mount $DRIVE && echo "${DRIVE} mounted."
127 # Umount and eject
128 #function eject()
130 #    DRIVE=/mnt/$1
131 #    umount $DRIVE && /usr/bin/eject $DRIVE && echo "${DRIVE} ejected."
135 # Completition
136 compctl -b bindkey
137 compctl -v export
138 compctl -o setopt
139 compctl -v unset
140 compctl -o unsetopt
141 compctl -v vared
142 compctl -c which
143 compctl -c sudo
147 # Some options..
148 setopt autopushd pushdminus pushdsilent pushdtohome
149 setopt autocd
150 setopt cdablevars
151 setopt globdots
152 #setopt ignoreeof
153 setopt interactivecomments
154 #setopt nobanghist
155 #setopt noclobber
156 setopt Histreduceblanks
157 setopt Histignorespace
158 setopt Histignorealldups
159 setopt SH_WORD_SPLIT
160 setopt nohup
161 setopt automenu
162 setopt autopushd               # automatically append dirs to the push/pop list
163 setopt pushdignoredups         # and don't duplicate them
164 setopt cdablevars              # avoid the need for an explicit $
165 setopt nohup                   # and don't kill them, either
166 #setopt listpacked              # compact completion lists
167 #setopt nolisttypes             # show types in completion
168 setopt dvorak                  # with spelling correction, assume dvorak kb
169 setopt extendedglob            # weird & wacky pattern matching - yay zsh!
170 setopt completeinword          # not just at the end
171 setopt alwaystoend             # when complete from middle, move cursor
172 setopt correct                 # spelling correction
173 #setopt nopromptcr              # don't add \n which overwrites cmds with no \n
174 setopt histverify              # when using ! cmds, confirm first
175 setopt interactivecomments     # escape commands so i can use them later
176 #setopt printexitvalue          # alert me if something's failed
177 setopt mailwarning
178 setopt mailwarn
181 # Auto Extension
182 alias -s jpg=display
183 alias -s JPG=display
184 alias -s png=display
185 alias -s gif=display
187 alias -s sxw=soffice
188 alias -s doc=soffice
190 alias -s java="$EDITOR"
191 alias -s txt="$EDITOR"
192 alias -s PKGBUILD="$EDITOR"
194 alias -s html=$BROWSER
195 alias -s org=$BROWSER
196 alias -s php=$BROWSER
197 alias -s com=$BROWSER
198 alias -s net=$BROWSER
200 alias -s avi="$MEDIA -idx"
201 alias -s xvid="$MEDIA -idx"
202 alias -s wmv="$MEDIA"
203 alias -s mov="$MEDIA"
204 alias -s mp4="$MEDIA"
205 alias -s mpg="$MEDIA"
206 alias -s mp3="$MEDIA"
207 alias -s wma="$MEDIA"
208 alias -s wav="$MEDIA"
210 alias -s chm=kchmviewer
211 alias -s pdf=evince
212 alias -s ttf=kfontview
214 setopt appendhistory autocd beep nomatch
215 bindkey -e
216 # End of lines configured by zsh-newuser-install
217 # The following lines were added by compinstall
218 zstyle :compinstall filename '~/.zshrc'
220 #autoload -Uz compinit
221 compinit
222 # End of lines added by compinstall
224 #alias ls='ls -CF --color=auto'
225 #alias ll='ls -l'
226 #alias lt='ls -ltr'
227 #alias la='ls -A'
228 #alias l='ls -CF'
229 #alias cd..='cd ..'
230 alias ls='ls -G'