I've long been a Cmder/ConEmu user for Windows as it's provided a much-needed improvement of the standard Windows terminal.
I've started trying to use the newer Windows Terminal project to benefit from the improved performance and support, and found getting it up and running with any customizations was a little time consuming and confusing. This wasn't something I'd hand off to someone who wasn't looking for experimentation.
So here it goes! Rather than hunting all around to get a nice start on some default prompts, I've linked to some gists that can help you get up and running quickly with a few extra perks.
Getting Started
This will help you get the terminal installed, along with downloading some settings I've already pre-setup with keybindings and more.
To customize your own keybindings, you can go to the profiles.json documentation.
# Run this to directly download and configure your profiles with the latest contents of the json above. | |
choco install microsoft-windows-terminal -y | |
$GistId = '93d8060e6f86e0c46535ef6699d6e0c8' | |
$GitHubUserName = 'sheldonhull' | |
$OutputFile = Join-Path $ENV:LOCALAPPDATA "Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json" | |
curl -o "$OutputFile" -H "Cache-Control: no-cache" "https://gist.githubusercontent.com/$GitHubUserName/$GistId/raw/window-terminal.json" | |
Improve Your Experience
After install, you can run the next command to help you get a better font setup with full support for ligatures and more.
#requires -RunAsAdministrator | |
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 # by default powershell uses TLS1.1. Github for example uses a more modern 1.2. Ensure using this as correct security protocol | |
# Scope for easy font install | |
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh') | |
scoop bucket add nerd-fonts | |
scoop update | |
$GenerateManifests = Join-Path $ENV:USERPROFILE 'scoop\buckets\nerd-fonts\bin\generate-manifests.ps1' | |
&$GenerateManifests | |
scoop install FiraCode-NF | |
scoop install UbuntuMono-NF | |
scoop install JetBrainsMono-NF | |
# Terminal Icons for Nice Display | |
choco install terminal-icons.powershell -y |
And after this, if you don't have a nice PowerShell prompt experience, this will help give you a great start. This contains a few things, including starship. This is really useful as it has a library of prompt enhancements baked in. For example, if you are have an AWS profile active, it will display that for reference. It can display an active terraform workspace, git branch info, python virtual environment and more. Definitely a nice quick productivity booster with no real configuration needed to get going.
choco install starship -y | |
choco install nodejs -y | |
choco install nano -y | |
install-module psreadline -AllowPrerelease -force | |
# because we need random cool ascii art to great us | |
npm install cowsay -g | |
Install-Module lolcat -Scope CurrentUser #cool color for starting up | |
Install-Module Nameit -Scope CurrentUser #for terminal session naming | |
$StarshipConfig = "$ENV:USERPROFILE/.config/starship.toml" | |
New-Item $StarshipConfig -ItemType File -Force | |
if(-not (Get-Content $StarshipConfig) -match 'add_newline') | |
{ | |
"add_newline = false" | Add-Content $StarshipConfig | |
} | |
if(-not (Test-Path $PSPROFILE -ItemType Leaf)) | |
{ | |
@" | |
Import-Module PSReadline | |
Invoke-Expression (&starship init powershell) | |
Import-Module Terminal-Icons | |
"welcome. Here's a 🌮" | cowsay.cmd -r | lolcat | |
"@ | Out-File $PSPROFILE -Encoding UTF8 | |
} | |
else | |
{ | |
Write-Warning "$PSPROFILE already exists. Manually update your file with the contents. I don't want to override anything you may have customized." | |
} | |
If you are wondering why I didn't leave the pretty awesome "useAcrylic": true
on for my main pwsh session, it's because I found the background contrast reduction made it hard to read some darker colors on the prompt.
Be sure to try out the retro pwsh theme for some nice eye candy.
The result
PowerShell Protip: Note the suggested completion based on prior commands in the pwsh prompt. This is some great prerelease work on a better PSReadline experience with Powershell.
Top comments (0)