-function precmd {
- print -Pn "\e]0;${SSH_CLIENT+$USER@$HOST}%#%(1j,:%j,):%~\a"
- vcs_info
- if ((SECONDS - _exectime >= 5)) {
- # bell after long exec
- print "\a"
- }
-}
-function preexec {
- printf "\033]0;%s\a" "$1"
- _exectime=$SECONDS
+### history
+setopt appendhistory
+HISTFILE=~/.histfile
+HISTSIZE=100
+SAVEHIST=100
+
+### keys
+bindkey -v
+KEYTIMEOUT=1
+## xorg
+bindkey "^[[7~" beginning-of-line #Home
+bindkey -a "^[[7~" beginning-of-line
+bindkey "^[[8~" end-of-line #End
+bindkey -a "^[[8~" end-of-line
+bindkey "^[[3~" delete-char #Del
+bindkey -a "^[[3~" delete-char
+## history search
+autoload -Uz up-line-or-beginning-search down-line-or-beginning-search
+zle -N up-line-or-beginning-search
+zle -N down-line-or-beginning-search
+[[ -n "$key[Up]" ]] && bindkey -- "$key[Up]" up-line-or-beginning-search
+[[ -n "$key[Down]" ]] && bindkey -- "$key[Down]" down-line-or-beginning-search
+
+### aliases
+alias h="history -25"
+alias j="jobs -l"
+alias l="ls -AF"
+alias ll="ls -lAFho"
+## ps
+local p="ps -aSdxwwouser=USR -ogroup=GRP -opid,nice=N \
+ -o%cpu,%mem,tt,stat,start=START -oetime,command | ${PAGER:-more} -Se"
+alias pa="$p"
+alias spa="sudo $p"
+unset p
+## py venv
+alias va="source bin/activate"
+alias vd="deactivate"
+## be paranoid
+alias cp='cp -ip'
+alias mv='mv -i'
+if [[ "$OSTYPE" =~ '^freebsd' ]] {
+ # don't confirm if only a few files are deleted
+ alias rm='rm -I'
+} else {
+ alias rm='rm -i'