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 option to print prompt in non-bold font #426

Open
lumaxis opened this issue Apr 23, 2018 · 12 comments · May be fixed by #1392
Open

Add option to print prompt in non-bold font #426

lumaxis opened this issue Apr 23, 2018 · 12 comments · May be fixed by #1392
Labels
proposal An issue (rarely PR) for feature-requests, ideas, etc

Comments

@lumaxis
Copy link

lumaxis commented Apr 23, 2018

Issue

I'd love for Spaceship to have option to not set bold as the default font style for the prompt. What do people think about this? If others are interested in this as well, I'd start prototyping a PR.

Screenshot

iTerm with bold fonts globally disabled:

screenshot 2018-04-23 19 33 47

Hyper with the Spaceship default:

screenshot 2018-04-23 19 33 28

Environment

Spaceship version: 3.3.0
Zsh version: zsh 5.3 (x86_64-apple-darwin17.0)
Zsh framework: oh-my-zsh
Zsh plugin manager: None
Terminal emulator: Hyper/iTerm
Operating system: macOS

@salmanulfarzy salmanulfarzy added the proposal An issue (rarely PR) for feature-requests, ideas, etc label Apr 25, 2018
@salmanulfarzy
Copy link
Member

bold disabled for section contents like git information or whole prompt including prefixes and suffixes ?

@timofurrer
Copy link

I would love to have such an option!

bold disabled for section contents like git information or whole prompt including prefixes and suffixes ?

IMHO: for all options where you can set the color.

@salmanulfarzy salmanulfarzy added the help-wanted We need help to resolve this issue or PR. label Jul 29, 2018
@salmanulfarzy salmanulfarzy mentioned this issue Jul 31, 2018
7 tasks
@salmanulfarzy salmanulfarzy added has-pr and removed help-wanted We need help to resolve this issue or PR. labels Oct 4, 2018
@denysdovhan denysdovhan added this to the v4.0.0 milestone Nov 20, 2018
@pcdevil
Copy link

pcdevil commented Oct 2, 2019

Moving the discussion from #519:

I would like to make this feature to be happen because of personal interest, but I want to align with the current route of the project.

My proposed approach would have a new standard parameter (SPACESHIP_PROMPT_DEFAULT_BOLD) which could have been overridden in sections.

But as @salmanulfarzy mentioned this would be overkill.
I interpret his concerns as this would bring too much complexity on the project for a feature not widely used (correct me if I am wrong). I tend to agree on the latter part, if it's not widely used than the new "API" would overwhelm the documentation for newcomers.
I respect his opinion and I understand the notion behind his thoughts so I would follow with a simpler solution (as he suggested):

A new standard parameter (SPACESHIP_PROMPT_BOLD) would be introduced to globally switch the boldness of the content part of the sections. The keyword here is content - this wouldn't change the behaviour of prefixes and suffixes.

This would be a more subtle change with less risk on the current codebase too.

I looked at the code and this would be easy to implement.

What your thoughts on this? (Mainly addressing the question to @salmanulfarzy)

If we are in a consensus I would follow-up with a WIP pull-request to eliminate the obstacles along the implementation.

@ortonomy
Copy link

ortonomy commented Jan 19, 2020

Any movement on this? This bolding of the prompt is really annoying. Why should I have to disable bold face globally in iTerm? Shouldn't this be a choice for spaceship? (considering how granularly everything else is configurable?)

image

@pcdevil
Copy link

pcdevil commented Jan 19, 2020

Hey @ortonomy,
I didn't move on this because wanted to get green light from @salmanulfarzy before implementing any code to avoid later confusion/discrepancies about it.

Any thoughts Salmanul?

@romkatv
Copy link

romkatv commented Jan 19, 2020

While you are waiting for the new option to be implemented, you can add the following snippet at the end of ~/.zshrc to unbold spaceship prompt.

() {
  local z=$'\0'
  PROMPT='${${${$(spaceship_prompt)//\%\%/'$z'}//\%B}//'$z'/%%}'
}

This performs 3 replace-all operations on PROMPT:

  1. Replace %% with $'\0' (special value that cannot be present in PROMPT).
  2. Replace %B with nothing. This removes all boldness.
  3. Replace $'\0' with %% to restore escaped percents.

Enjoy your spaceship prompt!

@ortonomy
Copy link

thanks @romkatv -- A pity I have to disable it globally.

@yoniamir
Copy link

yoniamir commented Apr 3, 2020

Thanks @romkatv nice workaround.

@dhasilva
Copy link

@romkatv This does not work for the right prompt here, unfortunately.

@romkatv
Copy link

romkatv commented Jun 26, 2021

@dhasilva You can add the same line for RPROMPT.

@dhasilva
Copy link

@romkatv Thank you, friend. It works!
For newbies like me finding this thread:

() {
  local z=$'\0'
  PROMPT='${${${$(spaceship_prompt)//\%\%/'$z'}//\%B}//'$z'/%%}'
  RPROMPT='${${${$(spaceship_rprompt)//\%\%/'$z'}//\%B}//'$z'/%%}'
}

@denysdovhan denysdovhan removed this from the v4.0.0 milestone Sep 2, 2022
@zhimsel
Copy link

zhimsel commented Nov 30, 2022

FYI, there are two new issues with the above workaround starting in v4+:

  1. The spaceship_[r]prompt functions have been moved to spaceship::[r]prompt.
  2. The workaround no longer works. I'm guessing it has something to do with the asynchronous prompt rendering; I'd wager that changing the $PROMPT variable directly does not take effect since the async process will replace it immediately after. I tested with SPACESHIP_PROMPT_ASYNC=false, but it still doesn't work. 🤷

zhimsel added a commit to zhimsel/dotfiles that referenced this issue Nov 30, 2022
martonivan pushed a commit to martonivan/spaceship-prompt that referenced this issue Sep 22, 2023
As it was requested in on of the oldest feature requests, some may
prefer to use the prompt with non-bold fonts.

resolve spaceship-prompt#426
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal An issue (rarely PR) for feature-requests, ideas, etc
10 participants