Skip to content

Import Statement Order

TIP

  • When adding Import-Module PSCompletions to your $Profile, its position matters.
  • In some cases, incorrect import order may cause PSCompletions to not work properly.
  1. If you need to use PSReadLine related configuration commands

    • Place them before Import-Module PSCompletions
    powershell
    # Get-PSReadLineOption
    $params = @{
       # InlineView/ListView
       PredictionViewStyle = 'ListView'
       # Audible/Visual/None
       BellStyle           = 'None'
       # Windows/Emacs/Vi
       EditMode            = 'Vi'
    }
    Set-PSReadLineOption @params
    Set-PSReadLineKeyHandler -Key 'Ctrl+z' -Function Undo
    Import-Module PSCompletions
    powershell
    # Get-PSReadLineOption
    Set-PSReadLineOption -PredictionViewStyle ListView -BellStyle None -EditMode vi
    Set-PSReadLineKeyHandler -Key 'Ctrl+z' -Function Undo
    Import-Module PSCompletions