- Oh My Posh theme
- Custom font
- Custom icons
- Auto-complete & command history
These instructions are based on this video but slightly modified and updated.
- Go to the Microsoft Store (search for "store" in Windows)
- Search for "Windows Terminal"
- Install
- Search for "PowerShell"
- Install
- (Alternatively you can install it from here)
- Search for "Oh My Posh"
- Install
- (Alternatively you can install it from here)
- Open up Windows Terminal
- Go to Settings
- Click "Open JSON file" in the lower left corner
- Replace the contents of that file with the contents of terminal-settings.json
- Save the file
OR
- Follow the steps below to set it up yourself
- Go to Startup
- Set default profile to
PowerShell
- Go to Startup
- Set default terminal application to
Windows Terminal
- Click on
Open JSON file
- Go to "profiles"
- Set "hidden" to
true
for every terminal exceptPowerShell
- Go to Startup
- Set it to "attach to the most recently used window"
-
Go to the Nerd Fonts website
-
Download the Hack Nerd font
-
Unzip the folder
-
Open up the "Font settings" (search for "fonts" in Windows)
-
Drag and drop all the
.ttf
files from the unzipped hack folder into the "Add fonts" square:
- Open up
Windows Terminal
- Go to Settings
- Go to Profiles > PowerShell
- Go to Additional Settings > Appearance
- Go to Font face
- Choose
Hack Nerd Font
, save
- Open up VS Code
- Go to Settings
- Go to Features > Terminal
- Scroll down to
Terminal › Integrated: Font Family
- Write "Hack Nerd Font", save and exit
PowerShell will look for a profile file to initialize each time you open the terminal in the path that gets printed if you run his command: echo $profile
. This file does not exist by default, so we need to create it.
- To create this file, simply run this command in your terminal
New-Item -Path $PROFILE -Type File -Force
- Run the command
code $PROFILE
to open up the newly created file in VS Code - Add the command
oh-my-posh init pwsh | Invoke-Expression
to the file, save - Refresh your profile by running the command
. $PROFILE
in the terminal - Your terminal should now look like this:
- These settings will be automatically initalized whenever you start the terminal from now on
- Open up the PowerShell profile file by running command
code $PROFILE
in your terminal - Replace the command you just added with this (adding the
--config
part):oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/jandedobbeleer.omp.json" | Invoke-Expression
- If you save and refresh your terminal, you should see that the theme changed
- You can now go to the theme page on the Oh My Posh website and look for whatever theme you want to try
- When you've found one, take the name and replace the
"jandedobbeleer"
part of the expression above, save, and refresh the terminal - For example, I like the "amro" theme, so the full expression would be:
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/amro.omp.json" | Invoke-Expression
- My terminal now looks like this:
- It is also possible to adjust themes if you want to read more about that.
- Add the
Terminal-Icons
package- Open your terminal and run the command
Install-Module -Name Terminal-Icons
- Open your terminal and run the command
- Go to your profile file (run the command
code $PROFILE
) - Under the
oh-my-posh init
line, add this code:Import-Module -Name Terminal-Icons
- Save and refresh your terminal
- You should now have custom icons in your terminal
- Before:
- After:
-
Add the
PSReadLine
package- Open your terminal and run the command
Install-Module -Name PSReadLine -AllowPrerelease -Force
- Open your terminal and run the command
-
Go to your profile file (run the command
code $PROFILE
) -
Under the
Import-Module
line, add this code:Import-Module -Name PSReadLine
-
Add these lines under that:
Set-PSReadLineOption -PredictionSource History
Set-PSReadLineOption -PredictionViewStyle ListView
Set-PSReadLineOption -EditMode Windows
- Save and refresh your terminal
- You should now have auto-complete and see a list of previous commands you've run in the terminal
- The updated profile file should now look the same as Microsoft.PowerShell_profile.ps1
- Note that this profile file also contains a custom
GitPrune
command that you can choose to keep or not
- Note that this profile file also contains a custom
- To update the version of your installed packages, run this command:
Update-Module -Name {NAME OF PACKAGE}
e.g:
Update-Module -Name PSReadLine
Update-Module -Name Terminal-Icons
- Then press "A" to check the "Yes to All" option if you get this warning:
- You can check what versions of packages you are using by running this command:
Get-InstalledModule
- Even though the process above 👆 should work for updating packages, you might have to do some troubleshooting if it does not:
- If you are not able to run the command in WT, then try running it in the normal "Command prompt" instead (
cmd.exe
), potentially starting the program as an administrator if you get any errors related to that - If you have updated the package but running the
Get-InstalledModule
only returns the previous un-updated package version, try this:- Go to the folder where PowerShell profile is (
echo $profile
) - Go into the "Modules" folder
- Go into the folder for the package you are trying to update, there should be multiple folders in here, one for each version
- Delete the previous version(s)
- Reload the PS profile
- Check again using
Get-InstalledModule
, the updated version should be the one that is being used now
- Go to the folder where PowerShell profile is (