Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Oh My Zsh
Commits
902e3172
Commit
902e3172
authored
Jul 07, 2019
by
Erik Demaine
Browse files
Avoid error messages when there is no job
parent
c1446b47
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/termsupport.zsh
View file @
902e3172
...
...
@@ -72,19 +72,22 @@ function omz_termsupport_preexec {
local
CMD
=
${
1
[(wr)^(*=*|sudo|ssh|mosh|rake|-*)]
:gs/%/%%
}
local
LINE
=
"
${
2
:gs/%/%%
}
"
# replace fg, possibly with argument, with description from jobs
if
[[
"
$CMD
"
=
fg
]]
;
then
# replace fg, possibly with argument, with description from jobs
local
JOB
if
[[
${
(z)1
}
=
fg
]]
;
then
# no arguments
JOB
=
"
$(
jobs
%%
)
"
JOB
=
"
$(
jobs
%%
2>/dev/null
)
"
else
# arguments
JOB
=
"
$(
jobs
${${
(z)1
}
[2]
}
)
"
JOB
=
"
$(
jobs
${${
(z)1
}
[2]
}
2>/dev/null
)
"
fi
if
[[
$?
-eq
0
]]
;
then
JOB
=
"
${${
(z)JOB
}
[4,
$]
}
"
# trim job number, +, pid, status
title
${
JOB
:gs/%/%%
}
${
JOB
:gs/%/%%
}
return
fi
JOB
=
"
${${
(z)JOB
}
[4,
$]
}
"
# trim job number, +, pid, status
title
${
JOB
:gs/%/%%
}
${
JOB
:gs/%/%%
}
else
title
'$CMD'
'%100>...>$LINE%<<'
fi
title
'$CMD'
'%100>...>$LINE%<<'
}
precmd_functions+
=(
omz_termsupport_precmd
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment