pwsh-syntax-highlighting icon indicating copy to clipboard operation
pwsh-syntax-highlighting copied to clipboard

zsh-syntax-highlighting for PowerShell.

pwsh-syntax-highlighting

This project is inspired by the zsh-syntax-highlighting project.

Requirement: pwsh 5.1+

This package provides syntax highlighting for PowerShell. It enables highlighting of commands whilst they are typed at a PowerShell prompt into an interactive terminal. This helps in reviewing commands before running them, particularly in catching syntax errors.

Preview

preview

How to install

  1. Run PowerShell as Administrator.

  2. Execute the following command:

    Install-Module syntax-highlighting
    
  3. Run the following and restart PowerShell:

    echo "Import-Module syntax-highlighting" >> $profile
    

    so you don't have to import the module every time you open PowerShell.

Limitations

  • Commands after a semicolon and second line commands will not be validated
  • Only works with Windows and doesn't work on macOS/Linux
  • Doesn't validate commands that begin with a "#" well

Credits


Rajeswar Khan