About . $PROFILE
TIP
. $PROFILEwill reload your PowerShell profile.- This affects the completion menu provided by PSCompletions.
- Therefore, after running
. $PROFILE, you need to runpscagain to reload the completion menu. - This is the simplest solution and applies to all the following situations.
psc menu config enable_menu 1
PSCompletions provides its completion menu in the following way:
<Key>is the value ofpsc menu config trigger_key(default:Tab)
powershellSet-PSReadLineKeyHandler -Key <Key> -ScriptBlock { # ... }However, after running
. $PROFILE:- PowerShell automatically resets the key binding:powershell
Set-PSReadLineKeyHandler -Key Tab -Function TabCompleteNext - Since the module is already loaded, the key-binding logic inside the module is not re-executed.
- As a result, the completion menu key binding is overridden by
TabCompleteNextand becomes ineffective.
- PowerShell automatically resets the key binding:
Therefore, you need to run
pscto reapply the key bindings.
psc menu config enable_menu 0
PSCompletions use
MenuCompletein the following way:<Key>is the value ofpsc menu config trigger_key(default:Tab)
powershellSet-PSReadLineKeyHandler -Key <Key> -Function MenuCompleteHowever, after running
. $PROFILE:PowerShell automatically resets the key binding:
powershellSet-PSReadLineKeyHandler -Key Tab -Function TabCompleteNextSince the module is already loaded, the key-binding logic inside the module is not re-executed.
As a result, it is overridden by
TabCompleteNextand becomes ineffective.
Therefore, you need to run
pscto reapply the key bindings.
NOTE
In this case, you can explicitly define the key binding in
$PROFILEto avoid this issue:powershellSet-PSReadLineKeyHandler -Key Tab -Function MenuCompleteIt should be placed before
Import-Module PSCompletionsRefer to Import Statement Order.