win-scripts/profile.ps1

49 lines
1.3 KiB
PowerShell

using namespace System.Management.Automation
Import-Module PSReadLine
# Setting up PATH
$env:Path = "$HOME/Bin/system/;" + "$env:Path"
$env:Path = "$HOME/Bin/custom/;" + "$env:Path"
$versionMinimum = [Version]'7.1.999'
if (($Host.Name -eq 'ConsoleHost') -and ($PSVersionTable.PSVersion -ge $versionMinimum))
{
Set-PSReadLineOption -PredictionSource HistoryAndPlugin
}
else
{
Set-PSReadLineOption -PredictionSource History
}
Set-PSReadLineOption -HistorySearchCursorMovesToEnd
Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward
Set-PSReadLineOption -PredictionViewStyle ListView
Set-PSReadlineOption -Color @{
"Command" = [ConsoleColor]::Green
"Parameter" = [ConsoleColor]::Gray
"Operator" = [ConsoleColor]::Magenta
"Variable" = [ConsoleColor]::White
"String" = [ConsoleColor]::Yellow
"Number" = [ConsoleColor]::Blue
"Type" = [ConsoleColor]::Cyan
"Comment" = [ConsoleColor]::DarkCyan
}
# Chocolatey profile
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile)) {
Import-Module "$ChocolateyProfile"
}
function dl {
Set-Location ~\Downloads
aria2c -j 16 -s 16 -x 16 -k 5M --file-allocation=none $args[0]
}
New-Alias vi nvim-qt.exe
Invoke-Expression (&starship init powershell)