justjanne / powerline-go

A beautiful and useful low-latency prompt for your shell, written in go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

add shlvl module

elig0n opened this issue · comments

Is your feature request related to a problem? Please describe.
$SHLVL can be added via -shell-var but it ends up in bright yellow color and I would like to substract from it or only show it
when it is larger than a number.

Describe the solution you'd like
Let pass an int value for -shlvl similar to -jobs, preferably with minimum argument i.e. -shlvl-min
and also allow setting the color for it or/and shell-var

I'm toying around with this.
https://github.com/buckley310/powerline-go/tree/shlvl
Is there anyone with a use-case other than "display shlvl if greater than 0" ?

Here's my current config. It uses nf-dev-terminal_badge from nerdfonts as the icon. (my powerline fork is current)
Any opinions or suggestions as to the icon/default color?
I just got this set up on my machine and I'm going to use it for a bit and see how it feels and how useful it is.

image

Update: it's useful.
The unicode characters tend to be a bit fiddly depending on the font/terminal, and getting powerline fonts to work in the first place is a bit of a hat trick. My current favorite icons are simply + and >.
image

I was just googling to see if it was possible to do this.. so +1 for your efforts. :)

FWIW, you can recreate this behavior today using an external plugin.
Adding the "shlvl" segment in powerline and then putting this bash script is in your PATH as powerline-go-shlvl

[ $SHLVL -lt 2 ] ||
    echo '[{"Foreground":231,"Background":55,"Content":"'$SHLVL'"}]'