Created
July 1, 2011 07:43
-
-
Save f440/1058052 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ "$TERM" = "screen" ]; then | |
chpwd () { echo -n "_`dirs | head -c 80`\\" } | |
preexec() { | |
# see [zsh-workers:13180] | |
# http://www.zsh.org/mla/workers/2000/msg03993.html | |
emulate -L zsh | |
local -a cmd; cmd=(${(z)2}) | |
case $cmd[1] in | |
fg) | |
if (( $#cmd == 1 )); then | |
cmd=(builtin jobs -l %+) | |
else | |
cmd=(builtin jobs -l $cmd[2]) | |
fi | |
;; | |
%*) | |
cmd=(builtin jobs -l $cmd[1]) | |
;; | |
cd|ssh|s) | |
if (( $#cmd >= 2)); then | |
cmd[1]=`echo $cmd[2] | sed -e 's/192.168./_/'` | |
fi | |
;& | |
*) | |
echo -n "k$cmd[1]:t\\" | |
return | |
;; | |
esac | |
local -A jt; jt=(${(kv)jobtexts}) | |
$cmd >>(read num rest | |
cmd=(${(z)${(e):-\$jt$num}}) | |
echo -n "k$cmd[1]:t\\") 2>/dev/null | |
} | |
chpwd | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment