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

Allow setting pre-prompt by user ENV var #464

Closed
wants to merge 2 commits into from

Conversation

samcv
Copy link

@samcv samcv commented Feb 26, 2019

This will allow you to add stuff before the start of the prompt and/or
change the color of the path.

For example to change the color of the path the user can do:
PURE_PROMPT_PRE='%F{blue}'

To add a clock before the line and alter the color of the path:
PURE_PROMPT_PRE='%* %F{blue}'

Other things can be done but this gives the user a lot of control to
customize the prompt.

Let me know your thoughts, and if it makes more sense to split the
path color and the PRE into separate variables.

This will allow you to add stuff before the start of the prompt and/or
change the color of the path.
@sindresorhus
Copy link
Owner

The coloring is already being fixed in #472.

Are there any other use-cases for this?

@samcv
Copy link
Author

samcv commented Jun 11, 2019

@sindresorhus what I use this for is to add a clock at the left side of the prompt, as well as change the color of the directory.

So it would be nice if we could add additional things at the left hand side.

@ashb
Copy link
Contributor

ashb commented Jun 18, 2019

Something like the pure_pieces from https://github.com/intelfx/pure#custom-handlers would support this:

# .zshrc

autoload -U promptinit; promptinit

# optionally define some options
PURE_CMD_MAX_EXEC_TIME=10

# optionally define custom generators
prompt_custom_time() {
	preprompt+=( "%F{gray}[%T]%f" )
}

prompt pure

# add the generator where it's needed
prompt_pure_pieces=(
	prompt_custom_time
	${prompt_pure_pieces:1}
)

@sindresorhus Would adding something like this be welcomed in a PR here?

@ashb
Copy link
Contributor

ashb commented Jun 18, 2019

See also #460

@sindresorhus
Copy link
Owner

Closing as this needs to be more fully thought through in #460. We also don't use environment variables anymore.

@sindresorhus
Copy link
Owner

@ashb Can you comment in that issue instead?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants