Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

my zsh prompt is not bold

I am customizing my zsh terminal but I face difficulties when it comes to turn my prompt into bold. I tried several different things, but none worked, whereas it did work for people on the Internet...

So this is my test prompt. Both "HEY" are in color 1, but the second "HEY" is supposed to be bold. It is obviously not, and instead of that, I get some flashy red, like the first part of my prompt, which is in color 9. wtf :)

Here is the code that I use in this case:

HEY%BHEY%b

I also noticed that it does the same thing for every one of the 8 first colors: black becomes grey, grey becomes white, night blue becomes dark blue, leaf green becomes flashy green, same for pink, yellow...

I also tried to use some escape sequences with the modulo, but none worked: each time, the modulo took the character next to it as its parameter and the rest of the code would just be displayed like normal characters. For example, this:

PS1="%{\e[1;33%}test"

would display this:

\e[1;33test

Could someone explain me what is going wrong here and how I could fix it to have some (real) bold prompt text?

like image 705
nounoursnoir Avatar asked Apr 08 '17 13:04

nounoursnoir


People also ask

How do I change the font on my zsh?

To change font in the Core Shell on your Mac, choose Core Shell > Preferences, then click General and choose a built-in font from the font panel.

How do I customize my zsh prompt?

To customize the ZSH prompt, we need to modify the prompt= variable inside the . zshrc file. We can populate the prompt variable with various placeholders, which will alter how the ZSH prompt appears.

How do I make zsh dark?

To change the Theme, simply change the ZSH_THEME value in ~/. zshrc file from robbyrussell to Avit. Run the following command to update the config. Open ITerm2 > Preferences > Profiles > Colors and change the background black color to use 20% gray as shown below.


2 Answers

this is late but might help someone, the way OP did it is correct, I believe the issue he's having is related to his font rendering settings.

here's a list of all the prompt variables used in zsh and tcsh

http://www.nparikh.org/unix/prompt.php

as it's stated there %B (%b) = Start (stop) boldface mode.

like image 153
user7055061 Avatar answered Nov 15 '22 12:11

user7055061


Read this doc and you will know what to do : Customizing the zsh Prompt

There are a bunch of options to modify zsh prompt.

For Bold, your command should be like this

PROMPT='%B %~ %b %# '

%B -> to start bold

%b -> to stop bold (so that only prompt is bold)

like image 31
Siddhant Gupta Avatar answered Nov 15 '22 13:11

Siddhant Gupta