How to change default Powershell language so "$" is Green
-
I thought it would be a more clean if the dollar sign used for variables would be green to more easily see them in script.
I just tried looking at the Npp User defined list collection, and tried out that one out, but no green $ , and I also just wish I could mode the default powershell to make it more intuitive in the NPP language menu.
Thank You
-
@Cooly0
If your goal is to only color the$
itself green and not the rest of the variable, I’d recommend using the EnhanceAnyLexer plugin.Just use
[powershell] ; $ in variable names is green 0x00c300 = \$(?=\w) ; just comment out, seems to work best for non-UDLs ; excluded_styles = 0,1,2,3,4,5,6,8,9,10,13,14,15,16
in
%AppData%\Roaming\Notepad++\plugins\Config\EnhanceAnyLexer\EnhanceAnyLexerConfig.ini
Result:
Unfortunately, this doesn’t colorize$
inside of quoted regions. This is outside the scope of EnhanceAnyLexer, it would seem. -
Hello, @cooly0, @mark-olson and All,
@mark-olson, from your picture, the first
$
sign, in the part between quotes :del "$($vsTemplatepath)\nppplugin*.zip"
Is not colored in green. This is quite normal as your regex is
\$(?=\w)
. I suppose that the correct regex should be, in this case,\$(?=[\w(])
So, it’s not a limitation of the @Ekopalypse’s plugin !!
Best Regards,
guy038