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

Add options to change secondary and/or root prompt chars #461

Merged
merged 1 commit into from
Oct 17, 2018
Merged

Add options to change secondary and/or root prompt chars #461

merged 1 commit into from
Oct 17, 2018

Conversation

Darkhogg
Copy link
Contributor

Description

Add two config variables to control the prompt character for secondary prompts and for the root user:

  • SPACESHIP_CHAR_SYMBOL_ROOT to change the root prompt
  • SPACESHIP_CHAR_SYMBOL_SECONDARY to change the seondary prompt

Both default to $SPACESHIP_CHAR_SYMBOL, so this change should not alter the current behaviour and not affect any users that don't change those vars.

Screenshot

With the following config:

SPACESHIP_CHAR_SYMBOL='$ '
SPACESHIP_CHAR_SYMBOL_ROOT='# '
SPACESHIP_CHAR_SYMBOL_SECONDARY='> '

I get the following prompts

screenshot_2018-05-31_12-00-30

(I also have all of them configured with the same color, but otherwise the regular color configuration is maintained)

This change allows users to decide if they want a different character for the
secondary prompt and for the root user.  This is achieved with the variables
`SPACESHIP_CHAR_SYMBOL_ROOT`, which is used in place of the default char
symbol if the current UID is 0, and `SPACESHIP_CHAR_SYMBOL_SECONDARY`, which
is used instead of the default char for the PS2 prompt.
@salmanulfarzy
Copy link
Member

Thanks @Darkhogg for PR. Let me try to address these changes from my perspective,

  • user section already alerts on user switching as root.
  • Secondary prompt is displayed with different color than primary prompt with is configurable via SPACESHIP_CHAR_COLOR_SECONDARY

So I would not favor this changes, But leaving this open for more discussion.

@salmanulfarzy salmanulfarzy added new-feature A PR that implement feature (section, specific behavior, etc). under-discussion labels Oct 14, 2018
@Darkhogg
Copy link
Contributor Author

Let me address your points specifically:

  • people might want to disable the user section but still have a way of identifying whether they're root or not. This is actually the default and I'd say expected behaviour for most if not all shells.
  • The color change of the secondary prompt can be non obvious, and again it being different it's the default and possibly expected behaviour for most shells.

As an "extremely customizable theme" (direct quote from the README), the ability to select how you want the prompt characters to look I think is a basic one, especially when it's something most shells already do out of the box. It's ok if you don't agree, but know that there's at least one user (me) that's using a fork instead of upstream primarily so these customizations are available.

@maximbaz
Copy link
Contributor

I think it's an interesting PR and is worth merging, one scenario where this would be useful is copy-paste, where colors are lost, but everyone is familiar with the conventional meaning of chars $, # and > in the prompt.

Copy link
Member

@salmanulfarzy salmanulfarzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@salmanulfarzy
Copy link
Member

As an "extremely customizable theme" (direct quote from the README)

We try to find the balance between being customizable and not to confuse users with too many options. That's why we try to think twice before adding new options and sections.

one scenario where this would be useful is copy-paste, where colors are lost, but everyone is familiar with the conventional meaning of chars $, # and > in the prompt.

Thanks @maximbaz, Didn't immediately think of that.

@salmanulfarzy salmanulfarzy merged commit c5ed80a into spaceship-prompt:master Oct 17, 2018
@salmanulfarzy
Copy link
Member

Thank you for contributing @Darkhogg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-feature A PR that implement feature (section, specific behavior, etc).
Development

Successfully merging this pull request may close these issues.

None yet

3 participants