Skip to content

Change default $env.TRANSIENT_PROMPT_COMMAND_RIGHT and $env.TRANSIENT_PROMPT_MULTILINE_INDICATOR #14565

Closed

Description

@NotTheDr01ds

Related problem

With our default right prompt and multiline indicator, copying multiline commands from the terminal can be problematic, since selecting those lines will include the right prompt and multiline indicator characters. This leads to a lot of manual deletion of prompt, as well as resulting whitespace.

Describe the solution you'd like

The transient prompt gives us a good way to handle this by default for users, resulting in a better out-of-the-box experience without sacrificing the useful right-prompt and multiline indicator themselves.

I'd like to set the defaults to:

$env.TRANSIENT_PROMPT_COMMAND_RIGHT = ""
$env.TRANSIENT_PROMPT_MULTILINE_INDICATOR = ""

This means that the right-prompt and multiline indicators will display for the current commandline (useful) but disappear after the command is entered.

Any objections?

Something to keep in mind is that the right-prompt doesn't show the time that the previous command was entered, so it's not accurate nor useful - It is actually showing the time that the previous command that generated that prompt was entered.

Users can, of course, override this by simply setting:

$env.TRANSIENT_PROMPT_COMMAND_RIGHT = null
$env.TRANSIENT_PROMPT_MULTILINE_INDICATOR = null

But I think having

Describe alternatives you've considered

No response

Additional context and details

No response

Activity

  1. added
    category:enhancement
    status:needs-triage
    on Dec 12, 2024
  2. Bahex commented on Dec 12, 2024

    @Bahex
    Member

    minor fix:

    - $env.TRANSIENT_MULTILINE_INDICATOR = ""
    + $env.TRANSIENT_PROMPT_MULTILINE_INDICATOR = ""
  3. NotTheDr01ds commented on Dec 12, 2024

    @NotTheDr01ds
    ContributorAuthor

    @Bahex Thanks! Fixed!

  4. fdncred commented on Dec 12, 2024

    @fdncred
    Contributor

    But I think having

    having what? Looks like you fell asleep at the keyboard. LOL

  5. fdncred commented on Dec 12, 2024

    @fdncred
    Contributor

    I'm not opposed to changing it. However, I disagree that the time isn't useful. I understand the point though of copying and pasting. I was planning on updating my personal transient prompt to remove the right prompt but also to put the execution time and datetime on the left side. I haven't fiddled around with it yet.

  6. NotTheDr01ds commented on Dec 12, 2024

    @NotTheDr01ds
    ContributorAuthor

    Looks like you fell asleep at the keyboard. LOL

    That is not far from the truth! The eyes were very blurry when typing it up last night :-)

    I think I meant to delete it ...

    I disagree that the time isn't useful

    Fair - In retrospect I can see that it might be useful because each right-prompt shows the time the previous commandline was executed.

    I'm not opposed to changing it.

    Alright - I'm going to make the change when I move the other prompt-related environment variables from default_env.nu to main(). That will probably (hopefully) be the last config related change before 0.101.

  7. NotTheDr01ds commented on Dec 12, 2024

    @NotTheDr01ds
    ContributorAuthor

    Oh wait, I might still try to get a user autoload dir in 0.101 ;-)

  8. ysthakur commented on Dec 13, 2024

    @ysthakur
    Member

    Since it looks like we don't want to change TRANSIENT_PROMPT_COMMAND_RIGHT by default, would it still be helpful to change only the default of TRANSIENT_PROMPT_MULTILINE_INDICATOR to an empty string?

  9. NotTheDr01ds commented on Dec 13, 2024

    @NotTheDr01ds
    ContributorAuthor

    @ysthakur Apologies for any confusion, but I thought we decided to change it. @fdncred said he was "not opposed to it", so I said I was going to make the change. It's in #14579.

    I think this is better "out-of-the-box" behavior for most users. As @fdncred said, moving the time/execution time to the transient left may even be better, but I don't know that making that a default would be a good idea as that would involve changing the TRANSIENT_PROMPT_COMMAND (left). That's a much more "invasive" change and should probably be left to user override.

  10. added
    A:configuration
    on Dec 14, 2024
  11. 132ikl commented on Dec 31, 2024

    @132ikl
    Member

    This should be closed now, right?

  12. neobrain commented on Apr 4, 2025

    @neobrain

    How do I revert to the old behavior for TRANSIENT_PROMPT_COMMAND_RIGHT? I found the time sticking around useful (though making it "update" to the time of executing the command to its left would be even better), but I couldn't find any documentation that explains how to customize these variables effectively.

    EDIT: Simply using $TRANSIENT_PROMPT_COMMAND_RIGHT = $env.PROMPT_COMMAND_RIGHT will restore the old behavior!

    EDIT2: I also tried making it refresh the date upon execution of the command; however, IIUC $env.TRANSIENT_PROMPT_COMMAND_RIGHT will be evaluated at the same time as the original right prompt. So even something like $env.TRANSIENT_PROMPT_COMMAND_RIGHT = { || date now } won't yield the desired effect.

  13. NotTheDr01ds commented on Apr 4, 2025

    @NotTheDr01ds
    ContributorAuthor

    @neobrain

    though making it "update" to the time of executing the command to its left would be even better

    Ah, you've discovered the main reason why (a) having the time in the right-prompt isn't as useful as it might be, and (b) (as a result) why I set the transient prompt to remove previous right-prompts - If it could be used like that, I probably would have left it in.

    Unfortunately, as far as I can tell, it's just a limitation of the way terminals, line-editors, and shells interact. Fish and Starship have the same issues.

    Each commandline is new instance of the line-editor (Reedline, in Nushell's case; usually Gnu Readline for Bash). Nushell has to tell the line-editor about all the prompts when it starts a new command-line. There just isn't a way to "update" that information after the command is executed.

  14. neobrain commented on Apr 5, 2025

    @neobrain

    I see - bummer there's this limitation, but I can see where it's coming from.

    Thanks for the reply!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A:configurationcategory:enhancementstatus:needs-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions