Skip to content

Instantly share code, notes, and snippets.

@ferr0
Last active February 2, 2022 08:36
Show Gist options
  • Save ferr0/fc19918028fc57399bad7a59c4847be6 to your computer and use it in GitHub Desktop.
Save ferr0/fc19918028fc57399bad7a59c4847be6 to your computer and use it in GitHub Desktop.
Install windows-terminal + powershell (Latest) on clean Win10/11

image

Install choco

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

Install package's

choco install curl netcat 7zip git microsoft-windows-terminal powershell-core 

Custom font's list

https://github.com/ryanoasis/nerd-fonts/releases

Install fonts -> CaskaydiaCove NF

choco install cascadia-code-nerd-font

In WT config(json)

                {
                    "face": "CaskaydiaCove NF",
                    "size": 14
                },

image

Install Powershell Modules

Install-Module oh-my-posh -Scope CurrentUser
Install-Module PSReadLine -AllowPrerelease -Force
Install-Module -Name Terminal-Icons -Repository PSGallery
#$> %homepath%\.oh-my-posh\aliens.omp.json
ADD to the END of block -> "blocks": [
-------------------------------------------------
{
"type": "root",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#FF0000",
"background": "#FFFF66",
"properties": {
"root_icon": ""
}
}
#Set UTF-8
#$PSDefaultParameterValues["Out-File:Encoding"] = "utf8"
$PSDefaultParameterValues = @{ '*:Encoding' = 'utf8' }
if ($host.Name -eq 'ConsoleHost')
{
Import-Module oh-my-posh
#
#Themes link: https://ohmyposh.dev/docs/themes
#
#Set-PoshPrompt -Theme jandedobbeleer
#Set-PoshPrompt -Theme marcduiker
Set-PoshPrompt -Theme aliens
Import-Module -Name Terminal-Icons
Import-Module PSReadLine
Set-PSReadLineOption -PredictionSource History
Set-PSReadLineOption -PredictionViewStyle ListView
Set-PSReadLineOption -EditMode Windows
# bash-style completion
Set-PSReadlineKeyHandler -Key Tab -Function Complete
Clear-Host
}
function aliasLr {Get-ChildItem -Recurse}
New-Alias -Name "ll" -Value "Get-ChildItem" -Description "Old Bash habbits never die"
New-Alias -Name "lr" -Value aliasLr
New-Alias -Name "nano" -Value "C:\Program Files\Notepad3\Notepad3.exe"
# Useful shortcuts for traversing directories
function cd... { cd ..\.. }
function cd.... { cd ..\..\.. }
# Compute file hashes - useful for checking successful downloads
function md5 { Get-FileHash -Algorithm MD5 $args }
function sha1 { Get-FileHash -Algorithm SHA1 $args }
function sha256 { Get-FileHash -Algorithm SHA256 $args }
# Quick shortcut to start notepad
function n { notepad $args }
# Drive shortcuts
function HKLM: { Set-Location HKLM: }
function HKCU: { Set-Location HKCU: }
function Env: { Set-Location Env: }
# Does the the rough equivalent of dir /s /b. For example, dirs *.png is dir /s /b *.png
function dirs
{
if ($args.Count -gt 0)
{
Get-ChildItem -Recurse -Include "$args" | Foreach-Object FullName
}
else
{
Get-ChildItem -Recurse | Foreach-Object FullName
}
}
# Simple function to start a new elevated process. If arguments are supplied then
# a single command is started with admin rights; if not then a new admin instance
# of PowerShell is started.
function admin
{
if ($args.Count -gt 0)
{
Stop-Process -Id $Processes[0].id
}
else
{
Start-Process -Verb RunAs wt
}
}
# Set UNIX-like aliases for the admin command, so sudo <command> will run the command
# with elevated rights.
Set-Alias -Name su -Value admin
Set-Alias -Name sudo -Value admin
# Make it easy to edit this profile once it's installed
function Edit-Profile
{
if ($host.Name -match "ise")
{
$psISE.CurrentPowerShellTab.Files.Add($profile.CurrentUserAllHosts)
}
else
{
notepad $profile
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment