The installOhMyPoshConfig
setting installs a pre-configured set of PowerShell profile files
that provide a fully-featured and ready-to-go terminal console experience.
Follow the Enhancement Guide to unlock the full potential of the PowerShell terminal in your Dev Container.
Here are some highlights:
This feature includes a custom Oh My Posh theme to customize the terminal prompt. You can change the theme to one that you prefer.
Note: Most other themes require installing a Nerd Font on your host system (not the Dev Container) and adjusting your font settings in VSCode. The Windows Terminal default font Cascadia Code now has a native Nerd Font variant, which can easily be installed and looks great in VSCode as well.
Command completion is crucial for productivity when using the command line. The profile includes multiple popular completions enabled out-of-the-box:
- Azure CLI (also see devcontainers/features/azure-cli)
- GitHub CLI (also see devcontainers/features/github-cli)
Posh-Git
: Tab completion support for common git commands, branch names, paths and more.Microsoft.PowerShell.UnixTabCompletion
: PowerShell parameter completers for native commands on Linux and macOS.PSReadLine
Predictive IntelliSense plugins:CompletionPredictor
: Command-line IntelliSense based on PowerShell auto-completion.
Optional completions that can be enabled:
Az.Tools.Predictor
: Module providing recommendations for cmdlets in theAz
module.- Oh My Posh CLI
PSFzf
: A PowerShell module that wrapsfzf
, a fuzzy file finder for the command line.
Other tools:
z
: Lets you quickly navigate the file system in PowerShell based on yourcd
command history.- Custom
dir
command alias to sort folders first and show hidden files.
-
Fully Customizable Profile Configuration:
Profile presets can be adjusted using
PSPROFILE_*
environment variables directly in yourdevcontainer.json
. Settings can be controlled separately for both regular PowerShell terminals and the VSCode PowerShell Extension host.Custom profile settings can be placed in profile directories to avoid modifying the built-in profile files. This includes separate directories for special terminal multiplexers like
tmux
. -
Fast Profile Load Time:
The profile uses delayed and parallel module imports to enhance load times. This approach provides a feature-rich terminal experience while maintaining quick responsiveness when opening a new terminal window.
-
Daily Update of Help Files:
A background job automatically updates help files once a day when a new shell is started.
This is a re-write of the original ghcr.io/devcontainers/features/powershell package. It uses Microsoft.PowerShell.PSResourceGet instead of PowerShellGet to install resources, which is included with PowerShell since version 7.4.0.
The new configuration options support an advanced syntax for 3rd party installation repositories as well as enhanced version definition, including version ranges and pre-releases.
To use advanced options for resource installation, you may do so using the extended resource name syntax:
[<Repository-URI>]Resource-Name[@<Version>]
Notation | Description |
---|---|
Az |
Installs the latest version. |
[email protected] |
Install exactly version 12.1.0. |
Az@[12.1.0,] |
Installs any version equal or greater than 12.1.0. |
Az@[12.1,12.2) |
Installs the latest bugfix release within the 12.1.x range. |
https://example.com/api/v2/MyPrivateModule |
Installs a module from a 3rd-party repository. The URI base is interpreted as resource name, while the rest is used as repository URI. |
For a detailled description about version formats, see Install-PSResource -Version
reference.
Resource repositories are automatically created using their domain, unless they are pre-defined with their name (see below). Note that these repositories will be available also after the container was created, but they will not be trusted automatically after the initial installation of resources.
IMPORTANT: Please note that multiple items must be separated using a semicolon (
;
). The comma is reserved to be used within version ranges as explained above. For example:[email protected]; [email protected]
To register a resource repository (or change PSGallery default repository), you make use this syntax:
[<Repository-Name>=]Repository-URI[^<Priority>]
Notation | Description | Resulting Repository Name |
---|---|---|
https://example.com/api/v2 |
Minimum example. | example.com |
MyRepo=https://example.com/api/v2 |
Setting an explicit repository name. | MyRepo |
https://www.poshtestgallery.com/api/v2^70 |
Add PowerShell Test Gallery with a decreased priority of 70. | www.poshtestgallery.com |
PSGallery^60 |
Decrease priority of PSGallery to 60. | PSGallery |
PSGallery |
Set PSGallery as trusted. | PSGallery |
Note that every repository you explicitly set in the configuration will automatically be configured as a trusted resource.
IMPORTANT: Please note that multiple items must be separated using a semicolon (
;
). It follows the principle used to separate items in theresources
option. For example:PSGallery; PoshTestGallery=https://www.poshtestgallery.com/api/v2^70