mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-12 20:21:02 +01:00
Automatic title: Replace fg with description from jobs
This commit is contained in:
parent
b259cdf7e7
commit
c1446b4750
1 changed files with 13 additions and 1 deletions
|
@ -72,7 +72,19 @@ function omz_termsupport_preexec {
|
|||
local CMD=${1[(wr)^(*=*|sudo|ssh|mosh|rake|-*)]:gs/%/%%}
|
||||
local LINE="${2:gs/%/%%}"
|
||||
|
||||
if [[ "$CMD" = fg ]]; then
|
||||
# replace fg, possibly with argument, with description from jobs
|
||||
local JOB
|
||||
if [[ ${(z)1} = fg ]]; then # no arguments
|
||||
JOB="$(jobs %%)"
|
||||
else # arguments
|
||||
JOB="$(jobs ${${(z)1}[2]})"
|
||||
fi
|
||||
JOB="${${(z)JOB}[4,$]}" # trim job number, +, pid, status
|
||||
title ${JOB:gs/%/%%} ${JOB:gs/%/%%}
|
||||
else
|
||||
title '$CMD' '%100>...>$LINE%<<'
|
||||
fi
|
||||
}
|
||||
|
||||
precmd_functions+=(omz_termsupport_precmd)
|
||||
|
|
Loading…
Reference in a new issue