Display location depth in prompt #570
Answered
by
JanDeDobbeleer
dpokluda
asked this question in
Troubleshoot
Prerequisites
DescriptionI have created my new theme but one thing that I can't figure out how to do, is that I would like to include the depth of my current location stack. For example in my existing (oh-my-posh v2) theme I used the following: Is there a way to achieve something like that? I have already looked at |
Answered by
JanDeDobbeleer
Mar 26, 2021
Replies: 2 comments
|
You can make use of the environment segment and use function Set-EnvVar {
$env:STACK_COUNT = '$(''+'' * ((get-location -stack).count))'
}
New-Alias -Name 'Set-PoshContext' -Value 'Set-EnvVar' -Scope Global |
0 replies
Answer selected by
dpokluda
|
Works perfectly, I wasn't aware of the fact that Thanks. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can make use of the environment segment and use
Set-PoshContextto add the stack count to an environment variable.