diff --git a/src/shell/scripts/omp.nu b/src/shell/scripts/omp.nu index b30d22a4..47ffee01 100644 --- a/src/shell/scripts/omp.nu +++ b/src/shell/scripts/omp.nu @@ -11,6 +11,11 @@ let-env NU_VERSION = (version | get version) let-env PROMPT_MULTILINE_INDICATOR = (^::OMP:: print secondary $"--config=($env.POSH_THEME)" --shell=nu $"--shell-version=($env.NU_VERSION)") let-env PROMPT_COMMAND = { + # We have to do this because the initial value of `$env.CMD_DURATION_MS` is always `0823`, + # which is an official setting. + # See https://github.com/nushell/nushell/discussions/6402#discussioncomment-3466687. + let cmd_duration = if $env.CMD_DURATION_MS == "0823" { 0 } else { $env.CMD_DURATION_MS } + let width = (term size -c | get columns | into string) - ^::OMP:: print primary $"--config=($env.POSH_THEME)" --shell=nu $"--shell-version=($env.NU_VERSION)" $"--execution-time=($env.CMD_DURATION_MS)" $"--error=($env.LAST_EXIT_CODE)" $"--terminal-width=($width)" + ^::OMP:: print primary $"--config=($env.POSH_THEME)" --shell=nu $"--shell-version=($env.NU_VERSION)" $"--execution-time=($cmd_duration)" $"--error=($env.LAST_EXIT_CODE)" $"--terminal-width=($width)" }