You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Change default $env.TRANSIENT_PROMPT_COMMAND_RIGHT and $env.TRANSIENT_PROMPT_MULTILINE_INDICATOR #14565
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.
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:
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.
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.
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?
@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.
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.
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.
Activity
Bahex commentedon Dec 12, 2024
minor fix:
NotTheDr01ds commentedon Dec 12, 2024
@Bahex Thanks! Fixed!
fdncred commentedon Dec 12, 2024
having what? Looks like you fell asleep at the keyboard. LOL
fdncred commentedon Dec 12, 2024
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.
NotTheDr01ds commentedon Dec 12, 2024
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 ...
Fair - In retrospect I can see that it might be useful because each right-prompt shows the time the previous commandline was executed.
Alright - I'm going to make the change when I move the other prompt-related environment variables from
default_env.nutomain(). That will probably (hopefully) be the last config related change before 0.101.NotTheDr01ds commentedon Dec 12, 2024
Oh wait, I might still try to get a user autoload dir in 0.101 ;-)
ysthakur commentedon Dec 13, 2024
Since it looks like we don't want to change
TRANSIENT_PROMPT_COMMAND_RIGHTby default, would it still be helpful to change only the default ofTRANSIENT_PROMPT_MULTILINE_INDICATORto an empty string?NotTheDr01ds commentedon Dec 13, 2024
@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.Moves additional env vars out of default_env and updates some transie…
132ikl commentedon Dec 31, 2024
This should be closed now, right?
neobrain commentedon Apr 4, 2025
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_RIGHTwill restore the old behavior!EDIT2: I also tried making it refresh the date upon execution of the command; however, IIUC
$env.TRANSIENT_PROMPT_COMMAND_RIGHTwill 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.NotTheDr01ds commentedon Apr 4, 2025
@neobrain
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.
neobrain commentedon Apr 5, 2025
I see - bummer there's this limitation, but I can see where it's coming from.
Thanks for the reply!