diff options
author | Hugues Hiegel <hugues@hiegel.fr> | 2009-02-16 10:53:20 +0100 |
---|---|---|
committer | Hugues Hiegel <hugues@hiegel.fr> | 2009-02-16 10:53:20 +0100 |
commit | 1088c07251e3dab900a27c265334e8d3739f29a3 (patch) | |
tree | c2aaf2e685128451b0121bdbe27de0d497bc00bd /01_Functions.zsh | |
parent | 54f257dad1882ef25b71943a85ea83e61824bd45 (diff) | |
parent | 168c0372ae76381ca0de343783c9a4f2f87a4df9 (diff) |
Merge commit 'origin/master'
Diffstat (limited to '01_Functions.zsh')
-rw-r--r-- | 01_Functions.zsh | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/01_Functions.zsh b/01_Functions.zsh index d598023..842e4d6 100644 --- a/01_Functions.zsh +++ b/01_Functions.zsh @@ -24,24 +24,34 @@ cmd_exists () term_title() { - [[ -t 1 ]] && - case $TERM in - sun-cmd) - print -Pn "\e]l%n@%m %~$@\e\\" # Never tested.. - ;; - *term*|rxvt*|putty) - print -Pn "\e]0;%n@%m (%l) %~$@\a" # Sets term title - ;; - screen) - # hardstatus - print -Pn "\e]2;[SCREEN #n] ?u(u) ?%n@%m (%l) %~$@\a" # Sets hardstatus line (term title) - # caption - [ $# -gt 0 ] && shift # discards the first arg, which is the separator, if any - print -Pn "\ek${@:-%~}\e\\" - ;; - *) - ;; - esac + + # Jobs + typeset -A command + for word in ${=2} ; command[$#comand]=$word + if [ "$command[0]" = "fg" ] + then + lastjob=$(ps ft `tty` | grep "[0-9]\+[[:blank:]]\+`tty | sed 's/\/dev\///'`[[:blank:]]\+T.\? \+.:.. \\\_ " | tail -n1 | cut -c32-) + set $1 $lastjob + fi + + [[ -t 1 ]] && + case $TERM in + sun-cmd) + print -Pn "\e]l%n@%m %~$@\e\\" # Never tested.. + ;; + *term*|rxvt*|putty) + print -Pn "\e]0;%n@%m (%l) %~$@\a" # Sets term title + ;; + screen) + # hardstatus + print -Pn "\e]2;[SCREEN #n] ?u(u) ?%n@%m (%l) %~$@\a" # Sets hardstatus line (term title) + # caption + [ $# -gt 0 ] && shift # discards the first arg, which is the separator, if any + print -Pn "\ek${@:-%~}\e\\" + ;; + *) + ;; + esac } preprint() |