Using dynamic help

Dynamic Help provides just-in-time help that allows you to stay focused on your work without losing your place typing on the command line.

Getting cmdlet help

Dynamic Help provides a view of full cmdlet help shown in an alternative screen buffer. PSReadLine maps the function ShowCommandHelp to the F1key.

  • When the cursor is at the end of a fully expanded cmdlet name, pressing F1displays the help for that cmdlet.
  • When the cursor is at the end of a fully expanded parameter name, pressing F1displays the help for the cmdlet beginning at the parameter.

Full screen Dynamic help

The pager in PSReadLine allows you to scroll the displayed help using the up and down arrow keys. Pressing Q exits the alternative screen buffer and returns to the current cursor position on the command line on the primary screen.

Getting focused parameter help

Pressing Alt+h provides dynamic help for parameters. The help is shown below the current command line similar to MenuComplete. The cursor must be at the end of the fully expanded parameter name when you press the Alt+h key.

Focused help for a parameter using Alt-h

Selecting arguments on the command line

To quickly select and edit the arguments of a cmdlet without disturbing your syntax using Alt+a. Based on the cursor position, it searches from the current cursor position and stops when it finds any arguments on the command line.

Argument selection using Alt-A

Choosing keybindings

Not all keybindings work for all operating systems and terminal applications. For example, keybindings for the Alt key don't work on macOS by default. On Linux, Ctrl+[ is the same as Escape. And Ctrl+Spacebar generates a Control+2 key sequence instead of the Control+Spacebar sequence expected.

To work around these quirks, map the PSReadLine function to an available key combination. For example:

Set-PSReadLineKeyHandler -chord 'Ctrl+l' -Function ShowParameterHelp
Set-PSReadLineKeyHandler -Chord 'Ctrl+k' -Function SelectCommandArgument

For more information about keybindings and workarounds, see Using PSReadLine key handlers.