Skip to content

feat(config)!: move the prompt into $env.config.prompt - #18734

Merged
kronberger-droid merged 19 commits into
nushell:mainfrom
kronberger-droid:prompt-indicator-config
Nov 14, 2026
Merged

kronberger-droid merged 19 commits into
nushell:mainfrom
kronberger-droid:prompt-indicator-config

Conversation

@kronberger-droid

@kronberger-droid kronberger-droid commented Jul 26, 2026 •

Copy link
Copy Markdown
Contributor

Description

The prompt was configured through twelve bare environment variables.
Six of them were seeded from Rust at REPL startup, two more by default_env.nu, and nothing kept them in step with the config.
All of it now lives in $env.config.prompt, together with render_right_prompt_on_last_line.

The old variables still take precedence when a session sets them, and nothing warns yet.
Thus every init script that writes them (starship, oh-my-posh, Dorothy, Couchbase Shell) keeps working unchanged.
The warning can follow once those have moved.

The default left and right prompts are still Nu closures.
A closure needs a parsed block, so they cannot sit in Config::default().
nu-cli evaluates them into $env.config.prompt before any config file runs, which keeps view source $env.config.prompt.left working and lets a config wrap the default.

The indicators cannot move into the prompt closure, since reedline hands render_prompt_indicator the current PromptEditMode, which the closure cannot see.

input --reedline reads the same config now and drops its own hardcoded indicators.

User-facing changes (Release notes)

The prompt is configured through $env.config.prompt

key default replaces
left closure showing the directory $env.PROMPT_COMMAND
right closure showing time and exit code $env.PROMPT_COMMAND_RIGHT
indicator "> " $env.PROMPT_INDICATOR
vi_insert "> " $env.PROMPT_INDICATOR_VI_INSERT
vi_normal ": " $env.PROMPT_INDICATOR_VI_NORMAL
vi_visual "+ " new
multiline "::: " $env.PROMPT_MULTILINE_INDICATOR
render_right_on_last_line false $env.config.render_right_prompt_on_last_line
transient.left null $env.TRANSIENT_PROMPT_COMMAND
transient.right "" $env.TRANSIENT_PROMPT_COMMAND_RIGHT
transient.indicator null $env.TRANSIENT_PROMPT_INDICATOR
transient.vi_insert null $env.TRANSIENT_PROMPT_INDICATOR_VI_INSERT
transient.vi_normal null $env.TRANSIENT_PROMPT_INDICATOR_VI_NORMAL
transient.vi_visual null new
transient.multiline "" $env.TRANSIENT_PROMPT_MULTILINE_INDICATOR

A transient key set to null keeps whatever the live prompt showed.

The twelve environment variables are deprecated.
They still win over the config when you set them, so a config or init script that assigns them keeps working.

Breaking changes

  • The variables are no longer seeded.
    $env.PROMPT_COMMAND, $env.PROMPT_INDICATOR and the rest now exist only if you set them yourself.
    Code that reads one to find the current prompt, like let old = $env.PROMPT_COMMAND, has to read $env.config.prompt.left instead.
    hide-env TRANSIENT_PROMPT_COMMAND_RIGHT, the old way to keep the right prompt in the transient prompt, now errors as well.
    Set $env.config.prompt.transient.right = null instead.
  • $env.config.render_right_prompt_on_last_line can no longer be read.
    Assigning the old name still sets prompt.render_right_on_last_line.
  • The vi indicators follow reedline's defaults.
    Insert mode shows "> " (was ": "), normal mode ": " (was "> ").
  • Vi visual mode has its own indicator, "+ ".
    It no longer follows $env.PROMPT_INDICATOR_VI_NORMAL.
    Helix select mode uses it too.
  • input --reedline follows $env.config.prompt, so its vi normal indicator changed from "〉" to ": " and its vi insert indicator from ": " to "> ".

commandline set-prompt gained --vi-visual.

config default reports the default prompt closures, so $env.config.prompt = (config default).prompt restores the default prompt.

Fixed the reverse-search indicator running into the matched entry: (reverse-search: ls)ls -la is now (reverse-search: ls) ls -la.

Additional notes

Checked against the nushell integration of every project in the README's "Officially Supported By" list.
Only virtualenv reads one of the variables: activate.nu wraps $env.PROMPT_COMMAND, and with nothing seeded the venv prompt loses the default prompt behind its prefix.
uv ships a copy of the same script.
Both need a fallback to $env.config.prompt.left, and venvs created before that fix keep the old script.
The starship and oh-my-posh init scripts were run against this branch and against main on a pty.
They render the same in emacs mode, in vi mode the only difference is the new default indicator.

OSC 133/633 emission is untouched, the sequences of a session on this branch and on main are identical.

@github-actions

Copy link
Copy Markdown

Hey, just a bot checking in! You edited files related to the configuration.
If you changed any of the default values or added a new config option, don't forget to update the doc_config.nu which documents the options for our users including the defaults provided by the Rust implementation.
If you didn't make a change here, you can just ignore me.

@fdncred

fdncred commented Jul 26, 2026 •

Copy link
Copy Markdown
Contributor

When this lands we'll probably need to notify 3rd party's like on-my-posh and starship maybe. I'm not sure who exactly uses $env.PROMPT_COMMAND other than them. We'll also need to change our documentation. Just found couchbase shell uses it.

@kronberger-droid

Copy link
Copy Markdown
Contributor Author

I think actually that no one can really use it.
Its tightly bound with the editor state which prompts don't know about i think.
At least starship leaves it alone.
But I will take a look at it.

Also regarding the issue with startship, i noticed that the Prompt indicator is actually not really playing into that and will be colored independently.

@kronberger-droid

Copy link
Copy Markdown
Contributor Author

Yeah okay they use it. I will take a look and maybe make a PR/issue for the change at the most important ones.

@kronberger-droid

Copy link
Copy Markdown
Contributor Author

But what we could actually just do it not warning and just keeping the fallback until they have merged. And only then start warning about it so individuals can change if they have defined a custom one through the env variable.
Since right now env > conf anyways, so there would not be anything breaking.

@fdncred

fdncred commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

oh-my-posh uses it too https://github.com/search?q=repo%3AJanDeDobbeleer%2Foh-my-posh+PROMPT_COMMAND&type=code - We should definitely make it a non-breaking change and maybe file issues on their repo. We could probably PR most of these ourselves since it's a pretty trivial change.

@kronberger-droid

Copy link
Copy Markdown
Contributor Author

Its non-breaking now already.
But it still warns, which might get annoying.
So i would just remove the warning for now and make the issues/prs for them some time soon.

@fdncred

fdncred commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

So i would just remove the warning for now and make the issues/prs for them some time soon.

Right. I think that's probably the best approach right now. Thanks!

@kronberger-droid

Copy link
Copy Markdown
Contributor Author

oh-my-posh uses it too https://github.com/search?q=repo%3AJanDeDobbeleer%2Foh-my-posh+PROMPT_COMMAND&type=code - We should definitely make it a non-breaking change and maybe file issues on their repo. We could probably PR most of these ourselves since it's a pretty trivial change.

This one is for PROMPT_COMMAND which we actually don't touch here.
Right now its merely for the PROMPT_INDICATOR related ones.

@fdncred

fdncred commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

omp sets that too https://github.com/search?q=repo%3AJanDeDobbeleer%2Foh-my-posh+PROMPT_INDICATOR&type=code but I'm confused, why would we go through this change and not change all the PROMPT things to $env.config.prompt like prompt, right_prompt, transient, etc? It seems like it might be more confusing to have some things as env vars and some as config. I'd vote for all one or the other.

@kronberger-droid

Copy link
Copy Markdown
Contributor Author

Well that's a good question.
I was quite focused on the prompt indicators since those where the entry point into all of this.
But you are right, makes sense to move all of those.
I will check it out and keep you updated.

@kronberger-droid
kronberger-droid marked this pull request as draft July 29, 2026 08:17
@kronberger-droid
kronberger-droid force-pushed the prompt-indicator-config branch from ec1106e to 539ab19 Compare August 7, 2026 09:40
@kronberger-droid

Copy link
Copy Markdown
Contributor Author

@fdncred
Prompt Commands are not a good idea to fold in there, they would not be a plain remap like the others, maybe worth a follow-up.
But I did the Transient Indicators.
I will check which downstream consumers will need changes and give them a heads-up before the release, but I think they usually write the env variables not read them, so it would be non-breaking for them.

@kronberger-droid
kronberger-droid marked this pull request as ready for review August 7, 2026 10:30
@fdncred

fdncred commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

I don't like the idea of having all the prompt settings in one place and then changing it to two places. It's confusing. I think we either need to change all of them at once or leave them where they're at.

kronberger-droid added a commit to kronberger-droid/nushell that referenced this pull request Aug 25, 2026
The indicators moved in 4211353, which left the prompt configured in
two places. fdncred's call on nushell#18734 was all or nothing, so this brings
`PROMPT_COMMAND`, `PROMPT_COMMAND_RIGHT` and their transient twins across
too. The variables still win when set, so starship, oh-my-posh and
couchbase shell keep working untouched.

Closures can live in config after all: `Hooks` already stores raw
`Value`s that are closures, so `prompt.left` and `prompt.right` take a
string used verbatim or a closure evaluated once per cycle, exactly what
the variables took.

The shipped default stays in `default_env.nu` since a closure needs a
parsed block. Putting it in `default_config.nu` instead would load after
the user's `env.nu` and clobber a prompt set there.

No variable is seeded at startup any more. Seeding one would pin every
session to it and leave the config key with no way to take effect, but it
does mean code that reads `$env.PROMPT_INDICATOR` to discover the current
prompt now finds nothing.

`input --reedline` resolves the same way, so a user still on the
variables does not get one indicator at the prompt and another inside
`input`.
kronberger-droid added a commit to kronberger-droid/reedline that referenced this pull request Aug 27, 2026
`Vi::default` and `Helix::default` both start in insert, thus the first
glyph anyone saw on entering a modal mode was `: `, reserved for the state
least like emacs, while the state they had landed in behaves exactly like
it. Normal held `> `, so emacs and vi normal rendered alike. The two
values are swapped rather than replaced, since `:` is the ex prompt and
already means the keys are commands. Visual and select had no glyph at all
and fell back to normal's.

Still not a break, since the constants were unreachable before: the
module is private and nothing re-exported them. They are public now
and named for the state rather than the dialect, since vi and helix
share every value and disagree only on what to call the third one.
Downstreams with their own prompt see nothing change; nushell keeps
its own defaults and matches by hand, a pass still open in
nushell/nushell#18734 which currently carries the old pair.
The four prompt indicators were configured through bare environment
variables that `src/main.rs` seeded once at REPL startup and nothing
ever updated. They are now `$env.config.prompt.{indicator, vi_insert,
vi_normal, vi_visual, multiline}`, defaulting from
`PromptConfig::default()`.

The environment variables still take precedence when set, so existing
`env.nu` files render unchanged, but reaching for one emits a
deprecation warning pointing at the config key. It uses
`ReportMode::FirstUse`, so it shows once per session rather than
before every command.

`vi_visual` is new and config-only. Visual mode previously aliased the
vi normal indicator and fell back to "v " only when that was unset, so
it silently lost the distinction as soon as anyone configured vi
normal.
`ReedlinePrompt` carried its own `DEFAULT_VI_*` constants, so the vi
mode indicators shown by `input --reedline` were hardcoded and
disagreed with the REPL: vi normal rendered "〉" there and "> " in
the REPL.

They now come from `$env.config.prompt`, which removes the second
source of truth and means configuring an indicator applies
everywhere.

The emacs slot is left alone. `input` repurposes it for the
`(default: ...)` hint, and the caller already supplies their own
prompt text, so `prompt_config.indicator` would append a second
prompt.
`engine_state.get_config()` returns the global config, so a
stack-scoped `$env.config.prompt` override was invisible to
`input --reedline`. Every other config read in `nu-command` uses
`stack.get_config(engine_state)`, which layers the stack config over
the global one.
Sits next to `get_editor`, which resolves `$env.config.buffer_editor`
against `$env.EDITOR` the same way. Nothing calls it yet; the prompt move
in the following commit does, from both `nu-cli` and `nu-command`.
The indicators moved in 4211353, which left the prompt configured in
two places. fdncred's call on nushell#18734 was all or nothing, so this brings
`PROMPT_COMMAND`, `PROMPT_COMMAND_RIGHT` and their transient twins across
too. The variables still win when set, so starship, oh-my-posh and
couchbase shell keep working untouched.

Closures can live in config after all: `Hooks` already stores raw
`Value`s that are closures, so `prompt.left` and `prompt.right` take a
string used verbatim or a closure evaluated once per cycle, exactly what
the variables took.

The shipped default stays in `default_env.nu` since a closure needs a
parsed block. Putting it in `default_config.nu` instead would load after
the user's `env.nu` and clobber a prompt set there.

No variable is seeded at startup any more. Seeding one would pin every
session to it and leave the config key with no way to take effect, but it
does mean code that reads `$env.PROMPT_INDICATOR` to discover the current
prompt now finds nothing.

`input --reedline` resolves the same way, so a user still on the
variables does not get one indicator at the prompt and another inside
`input`.
The last prompt setting outside the section. Renaming it is breaking
where the environment variables were not, since a config key has no
older spelling that keeps winning.

Aliasing the old name onto the new one was the first attempt and is
worse than it looks: `$env.config` is rebuilt from `Config` after every
update, so writes would keep working while reads of the old name failed.
`deprecated_option` errors on assignment instead and names the
replacement, which is a one-line fix for anyone who hits it.
The config bot asks for this whenever `doc_config.nu` drifts from the
Rust defaults. Two behaviour notes have nowhere else to live: nothing is
seeded at startup any more, so `hide-env TRANSIENT_PROMPT_COMMAND_RIGHT`
no longer brings the live right prompt back and `null` is the
replacement, and code that reads a `PROMPT_` variable to discover the
current prompt has to read `$env.config.prompt` instead.
reedline swapped its insert and normal indicators and gave select a glyph
of its own, so insert is now `> `, normal `: ` and visual `+ `. Ours still
encoded the old assignment, thus the next reedline bump would have put `: `
back on vi insert and reintroduced exactly the confusion that change fixed.

`nu-protocol` cannot name reedline's constants without depending on the
line editor, so the values stay typed out and the existing
`defaults_match_prompt_config` guard keeps the fallbacks in step. A drift
test against the constants themselves belongs in the reedline bump, where
`nu-cli` can see them.

`input --reedline` read the vi indicators it had just lost and lumped helix
select in with normal; it now reads the same config keys, and select takes
the visual one, since that is the state whose motions grow a span.
# PROMPT_COMMAND: Defines the primary prompt.
# Note: PROMPT_INDICATOR is appended to this value.
# Default: A closure that displays the current directory with colors.
$env.PROMPT_COMMAND = {||

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like we should keep these as $env.config.prompt.left and .right. we moved these here from the env.nu file because we were deprecating the env.nu file. i wonder if we still need them in the default_env.nu file or not if we kept them here?

@kronberger-droid kronberger-droid Sep 2, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right that removing them was unnecessary, but still doc_config.nu is never executed. It is only be used in config nu --doc.
We could move them into default_config.nu with some checks, but you can't really do a default value for a closure, so dropping is not possible. So no default_*.nu is not really a thing i think.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should probably stay in doc_config.nu as documentation and maybe in default_config.nu. We could call get_prompt_string() to set a default, couldn't we? But I was thinking default should be whatever reedline provides as a default.

@fdncred

fdncred commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

The last thing I worry about on this PR is that it changes the emitting of OSC ansi escape sequences. I'm not saying it does but I'm wondering if it does. I'm not sure we have any tests that validate we're emitting them right or not but I know I worked a long time getting them to work and they emit at the same time the prompt is drawn, as i remember.

@kronberger-droid

kronberger-droid commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor Author

We don't touch OSC, so in theory it should not be a problem, since we only change the origin for the prompt related definitions and OSC are handled somewhere else entirely. But I will still keep an eye out if there are enough tests to really claim that.

A nested `nu` drew no indicator at all: its parent exported an empty
`PROMPT_INDICATOR`, and with the startup seeding gone nothing
overwrote it before it took precedence over `$env.config.prompt`.

All twelve variables are hidden rather than the six the seeding used
to cover, since each of them now overrides a config key. Only the
REPL hides them, so a script still sees what it inherited.
Users still on the deprecated variables now see them at the prompt but
not inside `input`, which is how `input` behaved before it read them.
Keeping that consistency would have meant honoring whatever a parent
shell exports, including the old vi assignment a released `nu` seeds.
kronberger-droid added a commit to kronberger-droid/nushell that referenced this pull request Sep 14, 2026
The default left and right prompts exist only as closures in
`default_env.nu`, since a closure needs a parsed block and thus cannot
be a Rust default. That ties them to env.nu, which is on its way out.

`default_prompt_left` and `default_prompt_right` reproduce those
closures byte for byte. Nothing calls them yet: they become the
default once nushell#18734 moves the prompts into `$env.config.prompt` and
the closures can leave `default_env.nu`.

They live in `nu-command` rather than `nu-cli` since everything they
must agree with lives there: `is-admin`, the locale handling of
`format date`, and `path relative-to`. That keeps the shared pieces
crate-private and keeps `chrono::Locale` out of `nu-cli`, which only
sees that type today through feature unification.
`env.nu` is on its way out, and the prompts were the last thing
`default_env.nu` still set. They now live as Nu source in `nu-cli` and
are evaluated ahead of every startup file, so nothing about the load
order or the rendered prompt changes.

Rendering them natively in Rust instead was tried and dropped: with a
`null` default there is nothing to `view source` and nothing to wrap
with `do`, and both are how people build on the default prompt today.
Keeping them as source keeps them a real closure in `$env.config.prompt`.
@fdncred

fdncred commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

i'm working on the ci security problem here #19026

The starship and oh-my-posh init scripts both set the old key, so
reporting it as deprecated broke every one of their users. `omp.nu`
assigns it directly, which aborted the init before `PROMPT_COMMAND` was
set and skipped the rest of `config.nu`. starship puts it into `config:`
inside `load-env`, which does not reparse the config, thus the error
surfaced on some later, unrelated `$env.config` assignment.

Writes now land on `prompt.render_right_on_last_line` without a warning,
since a warning would fire on every startup for those users until the
scripts are updated. Reads of the old name still fail, which neither
script does.
c1a8ac2 hid all twelve deprecated variables at REPL start. Eight of
those were overwritten at startup anyway, six seeded from `main.rs` and
the two prompt commands set by `default_env.nu`, so hiding them changes
nothing for an inherited value. The other four transient ones were never
touched, and `TRANSIENT_PROMPT_COMMAND=... nu` from a parent shell or
direnv stopped working.
The note in `nu-cmd-base` still said `input --reedline` resolves through
the shared module, which dab429f undid.
…nfig

The prompt resolver takes over the `ClosureEvalOnce::try_new` call that
nushell#19159 gave `get_prompt_string`, so a prompt closure whose block is gone
is still reported instead of panicking. `commandline set-prompt` builds
its push as a `PromptContents` the way nushell#19236 does, with `vi_visual`
added.

The deprecation note in `doc_config.nu` names 0.118.0, the release this
now lands in.
`Config::default()` cannot hold the two prompt closures, so `config
default` said `null` for both and assigning its `prompt` back cleared
the prompt. Startup records the closures it evaluates on the engine
state, since `nu-command` cannot reach the Nu source in `nu-cli` and a
command has no way to parse a block at run time.
@kronberger-droid kronberger-droid changed the title feat(config)!: move prompt indicators to $env.config.prompt feat(config)!: move the prompt into $env.config.prompt Nov 13, 2026
@fdncred

fdncred commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

oh, i forgot about this one. we should land it when it's ready so we have time to work with it

@kronberger-droid

Copy link
Copy Markdown
Contributor Author

Yeah I will take a look at them once more to be sure they are clean as I planned them and will merge them soon.

kronberger-droid added a commit that referenced this pull request Nov 14, 2026
…8686)

## Description

reedline prints a foreground color in front of the left and the right
prompt, and `NushellPrompt` never overrode it.
Thus every unstyled piece of a custom prompt, like a starship module
with `style = "none"`, came out light green or purple instead of in the
terminal's own foreground.

`NushellPrompt` now answers `Color::Default` for a side that was
supplied, and keeps reedline's colors for a side that falls back to the
built-in prompt.
The two sides are judged separately.

The indicators keep their default colors.
They are nushell's own rather than the prompt generator's, and styling
one means putting the escapes into the indicator value.

## User-facing changes (Release notes)

Fixed unstyled text in a custom prompt being tinted light green (left)
or purple (right).
It now uses the terminal's default foreground, as in other shells.
A prompt that sets its own colors looks the same as before.

## Additional notes

fixes #16384

Based on `main`, since the `PromptState` rewrite it needed is already
there.
It conflicts with #18734 in one hunk, both append tests to
`crates/nu-cli/src/prompt.rs`, so whichever lands second needs that
merge.
@kronberger-droid
kronberger-droid merged commit 32d1af6 into nushell:main Nov 14, 2026
16 checks passed
@kronberger-droid
kronberger-droid deleted the prompt-indicator-config branch November 14, 2026 13:18
@github-actions github-actions Bot added this to the v0.118.0 milestone Nov 14, 2026
@fdncred fdncred added notes:ready Indicates Ready for Release notes notes:additions Noted in "Additions" section labels Nov 14, 2026
kronberger-droid added a commit to kronberger-droid/nushell that referenced this pull request Nov 19, 2026
The indicator keys in `$env.config.prompt` were typed as strings since
nushell#18734 moved them before `left` and `right`, when config was not yet
thought to hold closures. Moving `left` and `right` later showed it
can, but the indicators kept their type, thus `$env.PROMPT_INDICATOR`
and friends took a closure while the keys replacing them did not. An
indicator colored by the last exit code had no way across.

A live indicator still rejects `null`, since every edit mode draws one.
A closure that fails to render falls back to the built-in indicator.

`input --reedline` evaluates the keys too, so a closure works there as
well.
kronberger-droid added a commit to kronberger-droid/nushell that referenced this pull request Nov 20, 2026
The indicator keys in `$env.config.prompt` were typed as strings since
nushell#18734 moved them before `left` and `right`, when config was not yet
thought to hold closures. Moving `left` and `right` later showed it
can, but the indicators kept their type, thus `$env.PROMPT_INDICATOR`
and friends took a closure while the keys replacing them did not. An
indicator colored by the last exit code had no way across.

A live indicator still rejects `null`, since every edit mode draws one.
A closure that fails to render falls back to the built-in indicator.

`input --reedline` evaluates the keys too, so a closure works there as
well.
kronberger-droid added a commit that referenced this pull request Nov 22, 2026
## Description

#18734 moved the prompt into `$env.config.prompt`, but the indicator
keys only took a string.
`$env.PROMPT_INDICATOR` and the other indicator variables always took a
closure too, thus migrating an indicator that changes with
`$env.LAST_EXIT_CODE` to the new keys was not possible.

This was never a decision.
The indicators moved first, typed as `String`, before `left` and `right`
joined the PR.
When those followed it turned out config can hold closures after all
(`Hooks` already does), but the indicator keys were never widened.

The indicators now go through the same path as `left` and `right`:
- **config**: the transient keys parse with `update_prompt_source`, the
live keys with an `update_indicator` that differs only by rejecting
`null`, since every edit mode draws an indicator.
- **resolution**: every segment resolves through
`resolve_prompt_source`, `vi_visual` (no variable) through `render`
directly.
- **removed**: `update_optional_string`, `resolve_indicator` and
`resolve_transient_indicator`, which only existed to carry the narrower
type.

A closure that fails to render reports its error and falls back to the
built-in indicator.
`input --reedline` renders the keys the same way.

**Scrutinize**: `crates/nu-cli/src/prompt_update.rs`, the evaluation
order of the segments is kept since any of them may have side effects
now.
**Skim**: the test updates in `crates/nu-protocol/src/config/prompt.rs`,
mostly `"x".into()` to `Value::test_string("x")`.

Tests: `nu-protocol` `config::prompt` 15/15, `nu-cli` `prompt` 28/28
including a new `configured_indicators_accept_closures` that parses and
renders real closures, `nu-command` `reedline_prompt` 1/1.
Clippy with CI flags clean on the touched crates.

## User-facing changes (Release notes)

`$env.config.prompt.indicator`, `vi_insert`, `vi_normal`, `vi_visual`
and `multiline`, plus their `transient` counterparts, now accept a
closure as well as a string, the same as `$env.PROMPT_INDICATOR` and
friends always did.

```nu
$env.config.prompt.indicator = {||
    if $env.LAST_EXIT_CODE == 0 { "> " } else { $"(ansi red)> (ansi reset)" }
}
```

## Additional notes

Follow-up to #18734.

[![AI:W
WRITE](https://img.shields.io/badge/AI-WRITE-grey?style=flat&logoSize=auto&labelColor=13171f)](https://0rwx.com)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

notes:additions Noted in "Additions" section notes:ready Indicates Ready for Release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants