rendered paste body###
# misc stuff.
if [ "`whoami`" != "root" ]; then
umask 077
else
umask 022
fi
if [[ -x =tdl ]]; then
chpwd() { [[ -r .tdldb ]] && echo "[$terminfo[bold]$fg[yellow]tdll$terminfo[sgr0]]" && tdll v }
echo "[$terminfo[bold]$fg[yellow]tdll$terminfo[sgr0]]"
tdll v
fi
:h() { vim --cmd ":silent help $@" --cmd "only" }
:q() { exit }
# I'm thinking about that everything that is starting with : will be passed through to vim... :Matrix anyone? ;-)
_screenwrite() { echo "$@" >! /tmp/zsh-exchange }
_screenpaste() { local paste_timer; [[ -z $1 ]] && paste_timer=35 || paste_timer=$1
[[ -n $WINDOW ]] && screen -X eval 'msgwait 0' 'readreg z /tmp/zsh-exchange' "slowpaste $paste_timer" 'paste z' 'slowpaste 0' 'msgwait 1' }
# lame test...
hello_world() { _screenwrite "echo Hello World!"; _screenpaste }
### occasional slip (and original intention for the above thingie...)
require() { if [[ -n $1 ]]; then
_screenwrite "irb\nrequire '$1'"; _screenpaste
fi }
### ridiculous (newlines in screen get somehow translated to CTRL-J, so that matches perfect with my .vimrc)
.new() { if [[ -n $1 ]]; then
if [[ ${1[0,3]} == "TC_" ]]; then
_screenwrite "vim test_${1[4,-1]:l}.rb\nOrequire '${1[4,-1]:l}'jo,tc${1[4,-1]}\n"
else
_screenwrite "vim ${1:l}.rb\noclass $1\ndef initialize\nddk$"
fi
_screenpaste
fi }
# I save super many keystrokes, yeah!
_define() { if [[ -n $1 ]]; then
_screenwrite "elinks\ng gg define:$1"; _screenpaste
fi }
_google() { if [[ -n $1 ]]; then
_screenwrite "elinks\ng gg $1"; _screenpaste
fi }
# Special Function [zshmisc(1)]
TRAPZERR() {
if [[ $? -eq 127 ]]; then
[[ "$LAST_CMD[-4,-1]" == ".new" ]] && .new $LAST_CMD[0,-5]
[[ "$LAST_CMD[0,7]" == "define:" ]] && _define $LAST_CMD[8,-1]
[[ "$LAST_CMD[0,7]" == "google:" ]] && _google $LAST_CMD[8,-1]
fi
}
# vim: ft=zsh