Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate prompt variable in config file #3978

Closed
ajeetdsouza opened this issue Aug 31, 2021 · 6 comments
Closed

Deprecate prompt variable in config file #3978

ajeetdsouza opened this issue Aug 31, 2021 · 6 comments
Labels
polish this problem makes nu feel unpolished

Comments

@ajeetdsouza
Copy link

ajeetdsouza commented Aug 31, 2021

Related problem

Now that #3918 has been merged, there are two apparent ways to set the prompt, potentially causing confusion. This doesn't serve any purpose either, since both the variable prompt and the environment variable PROMPT_STRING can be set from the config file.

Describe the solution you'd like

IMHO, the prompt variable should be deprecated and eventually removed. There should be one (and preferably only one) obvious way to do it.

Describe alternatives you've considered

The new way of setting the prompt would be in the env block:

[env]
PROMPT_STRING = "echo '>>> '"

Additional context and details

This would allow tools like zoxide and starship to dynamically update the prompt without relying on user intervention.

@fdncred
Copy link
Collaborator

fdncred commented Aug 31, 2021

ya, you're probably right. the difference between the two is that PROMPT_STRING can be updated dynamically with a script or a command and the change is reflected immediately. whereas prompt requires you to quit out and restart nushell.

I need to check with @elferherrera because i'm having problem swith prompt_string.

@fdncred
Copy link
Collaborator

fdncred commented Aug 31, 2021

Now that i look at this closer, I'm not sure.

I have a prompt in my config file that uses zoxide and other scripts. This is kind of my default prompt. If I do let-env PROMPT_STRING = "build-string '> '" it changes my prompt and I can go about my business with that new plain prompt. But now, if I do unlet-env PROMPT_STRING I get back my default prompt.

If we remove the prompt altogether, then the default prompt seems to be set from the rust code. I'll have to ponder this change for a bit.

@ajeetdsouza
Copy link
Author

If I do unlet-env PROMPT_STRING I get back my default prompt.

This is a fairly niche use case, and I'm not sure it's worth keeping an extra config variable for that purpose. Besides, you could just have two variables: simple_prompt and jazzy_prompt. If you want to switch over, you can use let-env PROMPT_STRING = $simple_prompt to do so.


Btw, I've migrated zoxide over to use PROMPT_STRING instead of the prompt variable. Since PROMPT_STRING can be set dynamically, zoxide does it automatically instead of asking the user to edit their prompt. See this line. As always, I'd love to hear your views on the change!

@fdncred
Copy link
Collaborator

fdncred commented Aug 31, 2021

as long as we can maintain the same functionality that we have today, i'm probably ok with deprecating prompt. we have to get the core team to buy into it though.

it does seem like prompt_string will make zoxide easier to configure for people. since it's dynamic maybe you could put some "nerd stats" in the prompt for zoxide usage. hehe

@kubouch kubouch added the polish this problem makes nu feel unpolished label Sep 10, 2021
@sholderbach
Copy link
Member

This should be out of date with the new engine/reedline prompt system using a different configuration model with the PROMPT_COMMAND taking a block to construct the prompt in config.nu @fdncred

@fdncred
Copy link
Collaborator

fdncred commented Feb 10, 2022

i believe the prompt environment variables can be blocks or strings currently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
polish this problem makes nu feel unpolished
Projects
None yet
Development

No branches or pull requests

4 participants