Created
September 25, 2025 05:31
-
-
Save bkataru/eccdc9c1ceb8eb776f8aec0023dc5279 to your computer and use it in GitHub Desktop.
Microsoft.PowerShell_profile.ps1 on da threadripper
This file contains hidden or 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
| Import-Module Terminal-Icons | |
| Import-Module posh-git | |
| function prompt { | |
| function Get-CPUUsage { | |
| $cpu = Get-CimInstance -ClassName Win32_Processor | Select-Object -ExpandProperty LoadPercentage | |
| return $cpu | |
| } | |
| function Get-MemoryUsage { | |
| $mem = Get-CimInstance -ClassName Win32_OperatingSystem | |
| $total = $mem.TotalVisibleMemorySize | |
| $free = $mem.FreePhysicalMemory | |
| $used = $total - $free | |
| $percent = ($used / $total) * 100 | |
| return [math]::Round($percent, 2) | |
| } | |
| function Get-DiskUsage { | |
| $disk = Get-PSDrive -Name C | |
| $used = $disk.Used / 1GB | |
| $total = ($disk.Used + $disk.Free) / 1GB | |
| $percent = ($used / $total) * 100 | |
| return [math]::Round($percent, 2) | |
| } | |
| $env:CPU_USAGE = Get-CPUUsage | |
| $env:MEM_USAGE = Get-MemoryUsage | |
| $env:DISK_USAGE = Get-DiskUsage | |
| $env:ZIG_VERSION = "0.14.0" | |
| oh-my-posh --init --shell pwsh --config ~/AppData/Local/Programs/oh-my-posh/themes/tron-legacy.omp.json | Invoke-Expression | |
| } | |
| prompt | |
| function fetch { | |
| Set-Alias winfetch pwshfetch-test-1 | |
| Set-Alias ffetch fastfetch | |
| } | |
| fetch | |
| function ps_read_line { | |
| Import-Module PSReadLine | |
| # shows navigable menu of all options when hitting Tab | |
| Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete | |
| # autocompletion for Arrow keys | |
| Set-PSReadLineOption -HistorySearchCursorMovesToEnd | |
| Set-PSReadLineKeyHandler -Key UpArrow -Function HistorySearchBackward | |
| Set-PSReadLineKeyHandler -Key DownArrow -Function HistorySearchForward | |
| Set-PSReadLineOption -ShowToolTips | |
| Set-PSReadLineOption -PredictionSource History | |
| } | |
| ps_read_line | |
| function ps_fzf { | |
| Import-Module PsFzf | |
| # `Ctrl+f` searches files, `Ctrl+r` searches command history | |
| Set-PsFzfOption -PsReadlineChordProvider 'Ctrl+f' -PSReadlineChordReverseHistory 'Ctrl+r' | |
| } | |
| ps_fzf | |
| function zoxide_init { Invoke-Expression (& { (zoxide init powershell | Out-String) }) } | |
| zoxide_init | |
| function remove_aliases { | |
| If (Test-Path Alias:curl) {Remove-Item Alias:curl} | |
| If (Test-Path Alias:wget) {Remove-Item Alias:wget} | |
| } | |
| remove_aliases | |
| function hosts_quick_edit { | |
| # hosts file quick edit with notepad | |
| function Global:np_hosts { notepad C:\Windows\System32\Drivers\etc\hosts } | |
| # hosts file quick edit with micro | |
| function Global:mu_hosts { micro C:\Windows\System32\Drivers\etc\hosts } | |
| # hosts file quick edit with lapce | |
| function Global:lps_hosts { Lapce C:\Windows\System32\Drivers\etc\hosts } | |
| } | |
| hosts_quick_edit | |
| function profile_quick_edit { | |
| # $PROFILE file quick edit with notepad | |
| function Global:np_profile { notepad $PROFILE } | |
| # $PROFILE file quick edit with micro | |
| function Global:mu_profile { micro $PROFILE } | |
| # $PROFILE file quick edit with lapce | |
| function Global:lps_profile { Lapce $PROFILE } | |
| } | |
| profile_quick_edit | |
| # generate single-file .txt context compiling all files in a given directory | |
| function contxtgen { | |
| C:\Development\scripts\contxtgen.ps1 @args | |
| } | |
| fnm env --use-on-cd --shell powershell | Out-String | Invoke-Expression |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
new, optimized, cleaned up,
starship-poweredMicrosoft.PowerShell_profile.ps1associated
starship.toml