Created
February 21, 2009 07:02
-
-
Save sotarok/67928 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
# screen のステータスバーに現在実行中のコマンドを表示 | |
# ref. http://nijino.homelinux.net/diary/200206.shtml#200206140 | |
if [ "$TERM" = "screen" ]; then | |
chpwd () { | |
echo -n "_`dirs`\\" | |
ls | |
} | |
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) | |
if (( $#cmd == 2)); then | |
cmd[1]=$cmd[2] | |
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