Community
    • Login

    How to change default Powershell language so "$" is Green

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 3 Posters 265 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      Cooly0
      last edited by

      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

      Mark OlsonM 1 Reply Last reply Reply Quote 0
      • Mark OlsonM
        Mark Olson @Cooly0
        last edited by Mark Olson

        @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:
        bad42df7-2e9f-4d46-8860-17ee2a057a64-image.png
        Unfortunately, this doesn’t colorize $ inside of quoted regions. This is outside the scope of EnhanceAnyLexer, it would seem.

        1 Reply Last reply Reply Quote 1
        • guy038G
          guy038
          last edited by guy038

          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

          1 Reply Last reply Reply Quote 3
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors