mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-30 02:44:42 +01:00
Avoid fork to get last command from history
This commit is contained in:
parent
ef589c7a20
commit
5869944bd2
1 changed files with 1 additions and 1 deletions
|
|
@ -23,7 +23,7 @@ __timer_display_timer_precmd() {
|
|||
local tdiff=$((cmd_end_time - __timer_cmd_start_time))
|
||||
unset __timer_cmd_start_time
|
||||
if [[ -z "${TIMER_THRESHOLD}" || ${tdiff} -ge "${TIMER_THRESHOLD}" ]]; then
|
||||
local last_cmd=$(fc -ln -1 | awk '{print $1}')
|
||||
local last_cmd="${history[$((HISTCMD - 1))]%% *}"
|
||||
if [[ "$last_cmd" != clear ]]; then
|
||||
local tdiffstr=$(__timer_format_duration ${tdiff})
|
||||
local cols=$((COLUMNS - ${#tdiffstr} - 1))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue