| Next revision | Previous revision |
| powershell_setup [2021/04/25 03:01] – created stephen | powershell_setup [2023/01/28 00:04] (current) – external edit 127.0.0.1 |
|---|
| ====== Powershell Setup ====== | ====== PowerShell Setup ====== |
| | |
| | ===== Setup PowerShell Gallery ===== |
| |
| - Run ''Get-PSRepository'' to verify if PowerShell Gallery is set up properly. If it isn't, you probably need to [[powershell_cheat_sheet#get_install-module_working_behind_a_webproxy|set up the web proxy settings]]. | - Run ''Get-PSRepository'' to verify if PowerShell Gallery is set up properly. If it isn't, you probably need to [[powershell_cheat_sheet#get_install-module_working_behind_a_webproxy|set up the web proxy settings]]. |
| - Run ''Find-Module posh-git'' to verify that modules can be installed. If you get 'Unable to resolve package source...' you will need to [[powershell_manual_module_installation|install it manually]] (don't bother trying to fix it). | - If ''https://www.powershellgallery.com/api/v2'' is untrusted, run this ''Set-PSRepository -Name PSGallery -InstallationPolicy Trusted''. |
| - Download the **FuraCode Nerd Font** from [[https://www.nerdfonts.com/font-downloads|Nerd Fonts]]. | - Run ''Find-Module BurntToast'' to verify that modules can be installed. If you get 'Unable to resolve package source...' you will need to [[powershell_manual_module_installation|install it manually]] (don't bother trying to fix it). |
| - Install all the 'F**u**ra Code xxx Nerd Font Complete.otf' fonts. Don't bother with the 'F**i**ra *' fonts. | |
| - Follow these [[https://github.com/JanDeDobbeleer/oh-my-posh?WT.mc_id=-blog-scottha#installation|instructions]] or these [[https://www.hanselman.com/blog/HowToMakeAPrettyPromptInWindowsTerminalWithPowerlineNerdFontsCascadiaCodeWSLAndOhmyposh.aspx|instructions]]. | ===== Install Stuff ===== |
| - The theme you like was 'Paradox', but is now 'avit'. | |
| | - Run ''Install-Module -Name BurntToast -Repository PSGallery''. |
| - Run ''Install-Module -Name Terminal-Icons -Repository PSGallery''. | - Run ''Install-Module -Name Terminal-Icons -Repository PSGallery''. |
| | - Run ''Install-Module posh-git -Scope CurrentUser''. |
| |
| <code powershell> | Older stuff that probably doesn't need to be installed anymore. |
| Import-Module posh-git | |
| Import-Module oh-my-posh | - Run ''winget install JanDeDobbeleer.OhMyPosh -s winget''. |
| Set-PoshPrompt -Theme avit | |
| Import-Module -Name Terminal-Icons | ===== Setup Profile ===== |
| Write-Output "Powershell version $($PSVersionTable.PSVersion)" | |
| | - Find your profile: ''$PROFILE | Format-List -Force'' |
| | - Test if it exists: ''Test-Path $profile'' |
| | - Create if it doesn't exist: ''New-Item -path $profile -type file –force'' |
| | - Edit it: ''code $profile'' |
| | - Put just this in it:<code powershell> |
| | . 'D:\Bin\Manuka\General Scripts\PowerShell startup.ps1' |
| </code> | </code> |
| |
| | ===== Picking a Theme ===== |
| | |
| | Current favorites: **pure** (minimalist) or **iterm2**. |
| | |
| | * Open Windows Terminal. |
| | * Spit it with two PowerShell terminals. |
| | * In both, switch to an interesting directory, e.g. ''cd C:\Dev\Common\Auto Hot Key\'' |
| | * In one terminal, type ''Get-PoshThemes''. |
| | * In the other, type ''Set-PoshPrompt -Theme whatever'' to play with it. |
| | |
| | ===== Screw it, use my own ===== |
| | |
| | Run this: |
| | <code powershell> |
| | oh-my-posh init pwsh --config 'D:\Bin\Common\Settings\Oh-my-posh themes\tallguy.omp.json' | Invoke-Expression |
| | </code> |
| |
| | {{tag>setup powershell}} |