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
Is there a way to customize the prompt by setting variables or configuration?
Reacted by Josh, Takeshi Sato, Brett Cannon, Matan Kushner, Waldir Pimenta, Ian Walter, Dirkjan Ochtman, Zooce, Keith Devens, CreepySkeleton and 8 more
I really want something like this (could be added to config). I'd like something better than the templating on offer in existing shells, which I can't, for the life of me, ever read.
Reacted by Odin, Ashrith Mekala, Waldir Pimenta, Steven Barragán Naranjo, Helder S Ribeiro, nickcox, Isaac Cambron and Alan
I think maybe we could use format-like strings for variables, like this:
{host} {user} {cwd} {vcs} $
And maybe some kinds of tags for colors? You can do foreground and background colors, so maybe prefix with f and b (or fg and bg)? Could use [] or <> or ().
I really like just setting an environment variable to an array of functions. As long as the functions print to stdout, it allows people to define arbitrary customizations without needing to rely on builtins.
I'm not certain on how starship is implemented under the hood though, so I'm not totally sure how easy it would be to integrate. But, it might be as simple as just importing the crate given it's Rust!
Reacted by Oz Sayag, Helder S Ribeiro, ૮༼⚆︿⚆༽つ, Tyler Hampton, Jay Sistar, Theo Paris and Ovais Reza
Reacted by Oz Sayag, Matan Kushner, Piotr Szczygieł, ૮༼⚆︿⚆༽つ, Michael G, Tyler Hampton, pakelley, Jay Sistar and daniel
7 Emojis seems like enough interest, I have poked around the code and it seems easy enough but will require a PR to the Starship repo to make it more library-friendly as currently it just writes directly to stdout - would be neater if there was a neatly exposed function to return the prompt as a string.
I could make it invoke the starship command externally but it just seems like such a good opportunity to grab some performance given both of these things are written in Rust!
As of 0.6.0, you can use starship. I'll close this issue, but if we feel like we want non-starship customization, we can explore that in a different issue.
Reacted by Matan Kushner, Ashrith Mekala, Jay Sistar and Alan
let-env PROMPT_COMMAND_RIGHT= '' # ...to hide the right prompt, for example. Or:let-env PROMPT_COMMAND= { your | awesome | prompt } # ...where "your awesome prompt" can be# any series of commands
Reacted by bugHoooge, João Penteado, Doru, xoffio, Lens, Fredrik Sundqvist, dunxen, José Manuel and SOFe (Jonathan Chan Kwan Yin)
Activity
sophiajt commentedon Aug 24, 2019
You can't customize the prompt, yet. That's something we could add in the future, though.
Joshfindit commentedon Aug 24, 2019
Biggest one for me: showing the git branch
twe4ked commentedon Aug 24, 2019
It shows the git branch by default!
wycats commentedon Aug 26, 2019
I really want something like this (could be added to
config). I'd like something better than the templating on offer in existing shells, which I can't, for the life of me, ever read.djc commentedon Aug 26, 2019
Have been thinking about this for the past few days. Some design thoughts:
For reference, what I've been using for bash:
export PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \W \$\[\033[00m\] 'And zsh:
I think maybe we could use format-like strings for variables, like this:
{host} {user} {cwd} {vcs} $And maybe some kinds of tags for colors? You can do foreground and background colors, so maybe prefix with
fandb(orfgandbg)? Could use[]or<>or().<f:bright-green>{user}@{host}</f:bright-green> {cwd} $sophiajt commentedon Aug 26, 2019
@djc I really like this:
We've been talking about using similar syntax for a string parsing function, so this would be a nice parallel people could learn and use.
wycats commentedon Aug 26, 2019
Something like this seems very cool.
jedahan commentedon Aug 27, 2019
I really like just setting an environment variable to an array of functions. As long as the functions print to stdout, it allows people to define arbitrary customizations without needing to rely on builtins.
It would be nice to have left and right prompt. See https://github.com/geometry-zsh/geometry as an example of what I mean.
Southclaws commentedon Sep 13, 2019
I'd love to join this shell with the Starship prompt, both written in Rust, it's a match made in heaven!
https://github.com/starship/starship
I'm not certain on how starship is implemented under the hood though, so I'm not totally sure how easy it would be to integrate. But, it might be as simple as just importing the crate given it's Rust!
Southclaws commentedon Oct 8, 2019
7 Emojis seems like enough interest, I have poked around the code and it seems easy enough but will require a PR to the Starship repo to make it more library-friendly as currently it just writes directly to stdout - would be neater if there was a neatly exposed function to return the prompt as a string.
I could make it invoke the starship command externally but it just seems like such a good opportunity to grab some performance given both of these things are written in Rust!
kbd commentedon Nov 8, 2019
I always love feeling seen by fellow geeks. That’s how I do my prompt and I wasn’t previously familiar with geometry.
sophiajt commentedon Nov 30, 2019
As of 0.6.0, you can use starship. I'll close this issue, but if we feel like we want non-starship customization, we can explore that in a different issue.
sophiajt commentedon Jun 28, 2020
For those finding this later, we did end up implementing configuring the internal prompt: #2064
It should be part of the 0.16.0 release.
pvarga-dni commentedon Apr 25, 2022
For those ending up here nowadays:
gadzhi-m commentedon Jun 10, 2022
Hello. How can I change the path in the prompt line from full path (/home/user) to tilde (~)?
Some small fix (nushell#356)