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

Drop LS_COLORS variable #273

Merged

Conversation

maximbaz
Copy link
Contributor

Here's why this is needed:

I use a custom provider for LS_COLORS which adds a lot more colors, so I don't want to use the LS_COLORS from this theme. However this theme overrides my definition.

You might ask, why don't I simply define my LS_COLORS after this theme is applied? The reason is, it is useful to define proper LS_COLORS in the very beginning of your zshrc, before plugins and themes are loaded, so that for example autocompletion plugin can use this variable and show suggestions in color. I use antigen, which defines both plugins and themes in one place, so I can't really put my own definition of LS_COLORS in between those lines.

I preserved the default value of true, so nobody will be affected by this change.

spaceship.zsh Outdated
@@ -91,6 +91,9 @@ SPACESHIP_PROMPT_SUFFIXES_SHOW="${SPACESHIP_PROMPT_SUFFIXES_SHOW:=true}"
SPACESHIP_PROMPT_DEFAULT_PREFIX="${SPACESHIP_PROMPT_DEFAULT_PREFIX:="via "}"
SPACESHIP_PROMPT_DEFAULT_SUFFIX="${SPACESHIP_PROMPT_DEFAULT_SUFFIX:=" "}"

# LS_COLORS
SPACESHIP_LSCOLORS_DEFINE="${SPACESHIP_LSCOLORS_DEFINE:=true}"
Copy link
Member

Choose a reason for hiding this comment

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

SPACESHIP_LSCOLORS_DEFINE 🤔

Option's name should be discussed. Maybe we should use just SPACESHIP_LSCOLORS and assign this variable default value. What do you think?

Copy link
Contributor Author

@maximbaz maximbaz Dec 11, 2017

Choose a reason for hiding this comment

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

Yeah, I'm not super fond of the name too 🙂

Maybe SPACESHIP_USE_LSCOLORS or SPACESHIP_USE_DEFAULT_LSCOLORS?

As for the idea about assigning a default value, I'm not sure that this is the best approach. Note that this theme actually defines two variables (LS_COLORS for Linux and LSCOLORS for Mac), as well as calls zstyle ':completion:*', and if people use a custom provider, all of this is already done and so none of this should be executed again by the prompt theme.

Alternatively we can define LSCOLORS and LS_COLORS if and only if they are undefined yet, that way we don't overwrite anything and yet keep defining the default value for those who don't use any other provider of LS_COLORS. But I'm a bit concerned about this behavior, I'm not as confident that this will not break something for some people. One explicit configuration variable with true as default value seems like a safer bet.


To be honest, this whole LS_COLORS block is a bit surprising for me to see as part of the prompt scheme, usually it's done somewhere else. Providing LS_COLORS is part of either a custom rich provider (like trapd00r/LS_COLORS) or part of framework (like prezto/init.zsh or oh-my-zsh/theme-and-appearance.zsh), while configuring zstyle ':completion:*' for autocompletion coloring is part of autocompletion plugins (like prezto/completion.zsh) or again part of the framework (like oh-my-zsh/theme-and-appearance.zsh).

Copy link
Contributor Author

@maximbaz maximbaz Jan 11, 2018

Choose a reason for hiding this comment

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

@denysdovhan since breaking changes are acceptable in 3.0, I would really recommend to consider removing this whole block exporting LS_COLORS from the spaceship theme, as I said above it doesn't feel like it belongs here.

Copy link
Member

Choose a reason for hiding this comment

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

@maximbaz I'm working on it 😉

@denysdovhan denysdovhan added this to the v3.0 milestone Dec 11, 2017
@denysdovhan denysdovhan added the improvement A PR that make small changes for improving UX, performance, readability, etc label Dec 11, 2017
@denysdovhan
Copy link
Member

What about dropping LS_COLORS at all? Maybe you're right, it doesn't seem to be a part of prompt.

@maximbaz
Copy link
Contributor Author

I'm completely supporting this! I'll make the change now 🙂

@denysdovhan denysdovhan changed the title Allow not redefining LS_COLORS variable Drop LS_COLORS variable Jan 12, 2018
@denysdovhan denysdovhan merged commit 50e09b9 into spaceship-prompt:3.0 Jan 12, 2018
@denysdovhan denysdovhan mentioned this pull request Jan 12, 2018
25 tasks
@maximbaz maximbaz deleted the make_lscolors_configurable-3.0 branch June 10, 2018 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement A PR that make small changes for improving UX, performance, readability, etc
Development

Successfully merging this pull request may close these issues.

2 participants