hash -d doc=/usr/share/doc
hash -d log=/var/log
+hash -d deb=/var/cache/apt/archives
# vim:ft=zsh
alias mbug='bts show --mbox'
alias bug='BROWSER=www-browser bts show'
-# handy documentation lookup on Debian
-# from http://www.michael-prokop.at/computer/config/.zshrc
+edalias() {
+ [[ -z "$1" ]] && { echo "Usage: edalias <alias_to_edit>" ; return 1 } || vared aliases'[$1]' ;
+}
+compdef _aliases edalias
+
+edfunc() {
+ [[ -z "$1" ]] && { echo "Usage: edfunc <function_to_edit>" ; return 1 } || zed -f "$1" ;
+}
+compdef _functions edfunc
+
doc() { cd /usr/share/doc/$1 }
compdef '_files -W /usr/share/doc -/' doc
function psgrep() { ps aux | grep "[${1[1]}]${1[2,-1]}" }
+alias rw-='chmod 600'
+alias rwx='chmod 700'
+alias r--='chmod 644'
+alias r-x='chmod 755'
+alias r-s='chmod 2755'
+alias rws='chmod 2775'
+
alias bofh='fortune bofh-excuses'
autoload -U baseconv
alias btd='btdownloadheadless'
+function asc () { autossh -t "$@" 'screen -qxp= || screen -qdRR' }
+compdef asc=ssh
+
alias mdtest='swaks -s localhost -t'
if whence devtodo >/dev/null; then
;;
esac
done
- local tmpfile=$(mktemp -t ${prefix}.XXXXXX)
+ local tmpfile=$(mktemp -t ${prefix:-vit}.XXXXXX)
[ -n "$stdin" ] && cat >| $tmpfile
sensible-editor $tmpfile </dev/tty >/dev/tty
echo $tmpfile
bindkey -e
# history expansion on pressing space
-bindkey ' ' magic-space
-
-# prefix search (up to cursor position)
-bindkey '^xp' history-beginning-search-backward
-bindkey '^xn' history-beginning-search-forward
+#bindkey ' ' magic-space
# repeat the previous shell-word ($WORDCHARS)
bindkey '\e=' copy-prev-shell-word
--- /dev/null
+typeset -Ag abbreviations
+abbreviations=(
+ '...' '../..'
+ '....' '../../..'
+ 'BG' '& exit'
+ 'C' '| wc'
+ 'G' '|& grep '
+ 'H' '| head'
+ 'HL' ' --help |& less -r'
+ 'L' '| less'
+ 'LL' '|& less -r'
+ 'N' '&>/dev/null'
+ 'SL' '| sort | less'
+ 'S' '| sort -u'
+ 'T' '| tail'
+ 'V' '|& vim -'
+)
+
+magic-abbrev-expand() {
+ local MATCH
+ LBUFFER=${LBUFFER%%(#m)[_a-zA-Z0-9]#}
+ LBUFFER+=${abbreviations[$MATCH]:-$MATCH}
+ zle self-insert
+}
+
+no-magic-abbrev-expand() {
+ LBUFFER+=' '
+}
+
+zle -N magic-abbrev-expand
+zle -N no-magic-abbrev-expand
+bindkey " " magic-abbrev-expand
+bindkey "^x " no-magic-abbrev-expand
+bindkey -M isearch " " self-insert
+
+# vim:ft=zsh
_insert_datestamp() { LBUFFER+=${(%):-'%D{%Y.%m.%d}'}:; }
zle -N insert-datestamp _insert_datestamp
-bindkey '^t' insert-datestamp
+bindkey '\et' insert-datestamp
+
+# prefix search (up to cursor position)
+autoload history-search-end
+zle -N history-beginning-search-backward-end history-search-end
+zle -N history-beginning-search-forward-end history-search-end
+bindkey "\e[5~" history-beginning-search-backward-end # PageUp
+bindkey "\e[6~" history-beginning-search-forward-end # PageDown
+
+_insert_last_typed_word() { zle insert-last-word -- 0 -1 };
+zle -N _insert_last_typed_word;
+bindkey "\em" _insert_last_typed_word
+
+autoload insert-unicode-char
+zle -N insert-unicode-char
+bindkey '^Xi' insert-unicode-char
+
+# jump behind the first word on the cmdline to add options
+function _jump_after_first_word() {
+ local words
+ words=(${(z)BUFFER})
+
+ if (( ${#words} <= 1 )) ; then
+ CURSOR=${#BUFFER}
+ else
+ CURSOR=${#${words[1]}}
+ fi
+}
+zle -N _jump_after_first_word
+bindkey '^x1' _jump_after_first_word
# vim:ft=zsh
setopt nohup
# do alert me of running jobs before exiting
setopt checkjobs
+# display PID when suspending processes as well
+setopt longlistjobs
# disable backslashed escape sequences unless -e is given to echo
setopt bsd_echo