Published on April 13, 2020 by Dominic Böttger · 2 min read
The new Windows Terminal is a big step forward for all people who like to work with the command line. It’s available in the Store or via Chocolatey. I suggest using the Store version to automatically stay up to date.
I did some modifications to the basic Terminal and PowerShell configuration which can eventually be helpful for some people.
PowerShell modules used by my configuration:
- posh-git: Provides status information about a repository and offers tab completion in the terminal.
- oh-my-posh: Beautifies the terminal
- z: It’s a port of the z bash shell script and lets you quickly navigate through your filesystem based on your history.
Installation
Choco - Package manager for windows:
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
PowerShell Core:
choco install powershell-core
Cascadia Code Font:
choco install cascadiacodepl
Configuration
First, configure your Terminal settings and set the font to “Cascadia Code PL”. Open the Windows Terminal, click on the “down-arrow” next to the tab bar and click on “Settings”.
After the Terminal settings have been modified it’s time to improve the PowerShell profile. Open it with:
code $profile
I added a function to automatically load or install modules depending on their installation state:
function Add-Module ($m) {
if (Get-Module $m) {
Write-Output "Module $m is already imported."
}
else {
try {
Import-Module $m -ErrorAction Stop
}
catch {
if (Find-Module -Name $m | Where-Object { $_.Name -eq $m }) {
Install-Module -Name $m -Force -Verbose -Scope CurrentUser -AllowClobber
Import-Module $m -Verbose
}
}
}
}
Add-Module "posh-git"
Add-Module "oh-my-posh"
Add-Module "z"
Set-Theme Paradox
Additional Resources
A website with copy-paste configuration for Windows Terminal themes: https://atomcorp.github.io/themes/
Written by Dominic Böttger
← Back to blog