Created
March 22, 2021 22:44
-
-
Save instance-id/8435b6cb5bfb31489cf7dbb6e31f9b31 to your computer and use it in GitHub Desktop.
PowerShell $PROFILE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$env:PYTHONIOENCODING = 'utf-8' | |
Set-Alias Edit "C:\Users\$($env:UserName)\AppData\Local\Programs\Microsoft VS Code Insiders\Code - Insiders.exe" | |
# -------------------------------------------------------------- Functions | |
function move-the-cursor([int]$x, [int] $y) { $Host.UI.RawUI.CursorPosition = New-Object System.Management.Automation.Host.Coordinates $x , $y; $Host.UI.Write('Hello') } | |
function RunAsAdmin { Start-Process -Verb RunAs (Get-Process -Id $PID).Path } | |
function Update-PowerShell { Update-PowershellCore -UsePackageManagement 'Yes' -DownloadDirectory "$HOME\Downloads" } | |
function ListFoldersByDate { dir | Sort-Object -Property LastWriteTime } | |
function ChocoUpdate { & choco update all } | |
function ChocoList { & choco list --local-only } | |
function Edit-ProfileFile { Edit $profile } | |
# -------------------------------------------------------- Clear and Reset | |
function ClearScreen { | |
Clear-Host | |
$size = (Get-Host).UI.RawUI.WindowSize | |
$Host.UI.RawUI.CursorPosition = @{ X = 0; Y = ($size.Height - 3) } | |
} | |
# ---------------------------------------------------------------- Aliases | |
Set-Alias psadmin RunAsAdmin | |
Set-Alias psupdate Update-PowerShell | |
Set-Alias la ListFoldersByDate | |
Set-Alias editprofile Edit-ProfileFile | |
Set-Alias clear ClearScreen | |
# ----------------------------------------------------------------- Prompt | |
Invoke-Expression (&starship init powershell) | |
$size = (Get-Host).UI.RawUI.WindowSize | |
$Host.UI.RawUI.CursorPosition = @{ X = 0; Y = ($size.Height - 3) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment