fix(nu): support starting with --no-history

resolves #4887
This commit is contained in:
Jan De Dobbeleer 2024-05-04 07:48:27 +02:00 committed by Jan De Dobbeleer
parent f03c6cb00c
commit 1c8347287a
3 changed files with 7 additions and 4 deletions

View file

@ -23,7 +23,10 @@ $env.PROMPT_MULTILINE_INDICATOR = (^::OMP:: print secondary $"--config=($env.POS
$env.PROMPT_COMMAND = { ||
# hack to set the cursor line to 1 when the user clears the screen
# this obviously isn't bulletproof, but it's a start
let clear = (history | is-empty) or ((history | last 1 | get 0.command) == "clear")
mut clear = false
if $nu.history-enabled {
$clear = (history | is-empty) or ((history | last 1 | get 0.command) == "clear")
}
^::OMP:: print primary $"--config=($env.POSH_THEME)" --shell=nu $"--shell-version=($env.POSH_SHELL_VERSION)" $"--execution-time=(posh_cmd_duration)" $"--status=($env.LAST_EXIT_CODE)" $"--terminal-width=(posh_width)" $"--cleared=($clear)"
}

View file

@ -158,7 +158,7 @@ Once altered, reload your config for the changes to take effect.
<TabItem value="nu">
:::caution
Oh My Posh requires Nushell v0.86.0 or higher.
Oh My Posh requires Nushell v0.93.0 or higher.
:::
Adjust the Oh My Posh init line in the Nushell env file (`$nu.env-path`) by adding the `--config` flag

View file

@ -104,7 +104,7 @@ exec fish
<TabItem value="nu">
:::caution
Oh My Posh requires Nushell v0.86.0 or higher.
Oh My Posh requires Nushell v0.93.0 or higher.
:::
Add the following line to the Nushell env file (`$nu.env-path`):