-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
fish_vcs_prompt: improve format string idea and document it #7047
Comments
Yeah, I have a working prototype. My question is what this should include? What is this useful for? One possibility is to replace the terlar git prompt with just a standard set of arguments to the main prompt. Also we might want to skip computing things we won't display. As I currently have it, you'd give a list of words for what you want to have where, like fish_git_prompt branch dirty upstream and that would then print the branch, the dirty-state and the upstream-state. Any unrecognized word is currently printed as-is, tho I think we want to ignore anything that looks like a word to make it more cross-compatible across versions. The code for this is actually acceptable, it's just a little weird that it accepts the arguments as a list yet won't print a space between them. Also I'm not sold on the need to reorder these things, and I have not found a nice way to specify e.g. "only print a separator here if there is something". It looks like this: |
Just to throw an idea out, what if fish provided something like:
And then users could do something like:
Edit: On second thought, I don't like my suggestion because the positional arguments would be inflexible and could basically never change. I believe I remember seeing discussion in another issue where someone suggested calling a function that would set some variables that you could then reference freely within your own function, and that's probably the better approach that still gets you the same sort of end result. Can't find the issue now though. |
I’m not sure if this is relevant but I find it annoying to not be able to reorder dirtystate/stagedstate/stashstate/untrackedfile/invalidstate. Maybe we should be able to use something like this?
I’m not sure where you want to draw the line between what should be available in fish out-of-the-box, and what should be be let to more advanced (sometimes cross-shell) prompts like silver or starship. |
So presumably all that needs to be done is to only use that value as the default? |
I’m not really sure. Now that the order has been changed (in 7116627), I don’t need this feature. I guess it would be useful to know who:
Because advanced users may also want to reorder branch/statuses/special states (ongoing merge, rebase, etc.), but you if you offer to configure this, a format string makes it hard to handles spaces properly when one item is not displayed because irrelevant, etc. |
Oh, what I meant was to allow that variable to work we just need to do set -q __fish_git_prompt_status_order
or set -g __fish_git_prompt_status_order .... This used to set the variable unconditionally when But I've then noticed that we weren't actually using it in the non-informative mode. |
I'm not entirely sure I understand this ticket, but I think this might be helpful feedback? I've been looking for how to remove the The why of For context, I'm an:
|
As mentioned in #7033 and on Reddit,
fish_git_prompt
can be supplied a string to format its output.This feature is undocumented, however it is quite rudimentary and IIRC not available in the svn or hg prompts, so before documenting it someone may want to work on those points.
The text was updated successfully, but these errors were encountered: