powerlevel10k icon indicating copy to clipboard operation
powerlevel10k copied to clipboard

Bold the entire vcs segment

Open jaymody opened this issue 10 months ago • 1 comments

Is there a way to make the entire vcs segment bold? I tried the following based on https://github.com/romkatv/powerlevel10k/issues/1063#issuecomment-712649752:

typeset -g POWERLEVEL9K_VCS_CONTENT_EXPANSION='%B[$P9K_CONTENT]%b'

But that only bolds the [:

Image

Here's my .p10k.sh file.

My guess is that somewhere in $P9K_CONTENT there's an %b or similar that is resetting formatting so the bold doesn't get applied. How do I work around this?

jaymody avatar Apr 26 '25 17:04 jaymody

So I came up with a workaround. First to find what the contents looked like in the first place:

typeset -g POWERLEVEL9K_VCS_CONTENT_EXPANSION='$(print -r -- "$P9K_CONTENT" > /tmp/a.txt)'

Which shows:

❯ cat /tmp/a.txt
%b%k%F{005}main%b%k%F{005}%b%k%F{005} !1

So yeah, the %b and %k is escaping the bold.

So, one hacky thing you could do is just append %B after each %k:

typeset -g POWERLEVEL9K_VCS_CONTENT_EXPANSION='%B[${P9K_CONTENT//\%k/${MATCH}%B}]%b'

There's probably a better solution (please let me know!), but this works (for now).

jaymody avatar Apr 26 '25 18:04 jaymody