VMSysAdmin

When you need another brain

Initial Powershell setup on a new Windows 10 system

leave a comment »

Set-ExecutionPolicy RemoteSigned -scope CurrentUser
iwr -useb get.scoop.sh | iex

scoop install git
scoop bucket add extras
scoop install pwsh
scoop install windows-terminal
scoop install vscode
scoop install fzf

Install-Module PowershellGet -Scope CurrentUser -Force -AllowClobber
Install-Module PsReadline -Scope CurrentUser -Force -AllowPrerelease
Install-Module PSFzf -Scope CurrentUser -AllowPrerelease

notepad $PROFILE

Set-PSReadLineKeyHandler -Key Ctrl+a -Function BeginningOfLine
Set-PSReadLineKeyHandler -Key Ctrl+e -Function EndOfLine
Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete
Set-PSReadLineKeyHandler -Key Ctrl+d -Function MenuComplete
Set-PSReadLineKeyHandler -Key Ctrl+f -Function ForwardWord
Set-PSReadLineKeyHandler -Key Ctrl+b -Function BackwardWord
Set-PSReadLineKeyHandler -Key Ctrl+z -Function Undo
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward
Set-PSReadlineOption -HistorySearchCursorMovesToEnd
Set-PSReadLineOption -BellStyle None
Set-PSReadLineOption -PredictionSource History

Import-Module PsFzf
Set-PsFzfOption -PSReadlineChordProvider Ctrl+t -PSReadlineChordReverseHistory Ctrl+r
Enable-PsFzfAliases

function hist {Get-Content (Get-PSReadLineOption).HistorySavePath | Get-Unique}
Set-Alias -Name which -Value "$env:SystemRoot\System32\where.exe"

 

Written by vmsysadmin

October 12, 2020 at 8:57 pm

Posted in Uncategorized

Leave a comment