gingerbreadboy
gingerbreadboy

Reputation: 7769

Changing colours at posh-git/powershell prompt

I can not work out how to change the -b flag and the quoted string to something more readable.

I have tried changing git settings, posh-git settings, and powershell settings. This stack answer was my last hope but I couldn't find which token-flag i need to change :(

Can anyone give an example of how I can change all switches/flags and quoted strings to something brighter? Thanks.

enter image description here

Upvotes: 0

Views: 441

Answers (1)

Ansgar Wiechers
Ansgar Wiechers

Reputation: 200193

From the documentation you referenced:

Parameter
A parameter to a command, always begins with a dash ('-'), followed by the parameter name. Tokens with this kind are always instances of ParameterToken.
[…]
StringExpandable
A double quoted string literal. Tokens with this kind are always instances of StringExpandableToken even if there are no nested tokens to expand.
StringLiteral
A single quoted string literal. Tokens with this kind are always instances of StringLiteralToken.

So this should do what you want:

Set-PSReadlineOption -TokenKind Parameter -ForegroundColor Gray
Set-PSReadlineOption -TokenKind StringExpandable -ForegroundColor Cyan
Set-PSReadlineOption -TokenKind StringLiteral -ForegroundColor Cyan

Upvotes: 1

Related Questions