$home\Documents\PowerShell\Microsoft.PowerShell_profile.ps1
$env:TERM = "xterm-256color" oh-my-posh init pwsh --config 'C:/Users/dhya/.mytheme.omp.json' | Invoke-Expression #oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/jandedobbeleer.omp.json" | Invoke-Expression ## Make Ctrl-D exit Set-PSReadlineKeyHandler -Key ctrl+d -Function DeleteCharOrExit ## PSReadLine Import-Module PSReadLine # enable bash style completion without using Emacs mode Set-PSReadLineKeyHandler -Key Tab -Function Complete Set-PSReadlineOption -BellStyle None <# Function prompt { $username = $Env:UserName $currdir = Split-Path -leaf -path (Get-Location) $compname = $env:COMPUTERNAME $identity = [Security.Principal.WindowsIdentity]::GetCurrent() $principal = [Security.Principal.WindowsPrincipal] $identity $adminRole = [Security.Principal.WindowsBuiltInRole]::Administrator $(if (Test-Path variable:/PSDebugContext) { '[DBG] ' } elseif($principal.IsInRole($adminRole)) { "[ADMIN] " } else { '' } ) + ("$([char]27)[32m$username$([char]27)[0m" + "@" + "$([char]27)[32m$compname$([char]27)[0m" + ":" + "$([char]27)[34m$currdir$([char]27)[0m" + $(if ($NestedPromptLevel -ge 1) { '>>' }) + '> ') # set title to currrent dir #$host.ui.RawUI.WindowTitle = $(get-location) # set title to last entered command #if ((Get-History).Count -gt 0) { # $Host.UI.RawUI.WindowTitle = # ((Get-History)[-1].CommandLine[0..25] -join '') #} } #> Set-Alias -Name ls -Value eza -Option AllScope Set-Alias 7z "C:\Program Files\7-Zip\7z.exe" $pythonPath = "C:\Lib\Python312\python.exe" Set-Alias python $pythonPath Set-Alias python3 $pythonPath # Vim Set-Alias vi "C:\Program Files\Vim\vim91\vim.exe" function view { vi -R $args } Set-Alias git "C:\Program Files\Git\bin\git.exe" # $env:USERPROFILE or $home? Function flip() { python $home\bin\flip.py } Function divine() { python $home\bin\divine.py } Function update-check() { winget list --upgrade-available --source=winget } Function upgrade() { # winget upgrade --all --include-unknown winget upgrade --all } Function id() { Write-Host "User: " -NoNewline [System.Security.Principal.WindowsIdentity]::GetCurrent().Name Write-Host "Has admin: " -NoNewline [bool](([System.Security.Principal.WindowsIdentity]::GetCurrent()).groups -match "S-1-5-32-544") } #Function less($name) { # source-highlight --failsafe -f esc -i "$name" | C:\ProgramData\chocolatey\bin\less.exe -R #} Function realpath($name) { Resolve-Path "$name" } Function touch($name) { New-Item "$name" } Function date() { Get-Date -Format "dddd yyyy-MM-dd HH:mm K" } Function which($name) { Get-Command "$name" | Select-Object -ExpandProperty Definition } Function host($name) { Resolve-DnsName -Name "$name" } Function disks() { wmic diskdrive list brief } Function psql() { C:\Program` Files\PostgreSQL\16\bin\psql.exe -U postgres $args } Function setJavaHome($name) { [System.Environment]::SetEnvironmentVariable('JAVA_HOME', $name, 'Machine') [System.Environment]::SetEnvironmentVariable('JAVA_HOME', $name, 'User') } # Import the Chocolatey Profile that contains the necessary code to enable # tab-completions to Function for `choco`. # Be aware that if you are missing these lines from your profile, tab completion # for `choco` will not function. # See https://ch0.co/tab-completion for details. $ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" if (Test-Path($ChocolateyProfile)) { Import-Module "$ChocolateyProfile" } Function getMSOfficeVersion { wmic product get caption,version | Select-String -Pattern "^Office.*Licensing Component" } # Fast Node Manager fnm env --fnm-dir C:\Lib\Node.js --use-on-cd | Out-String | Invoke-Expression # completer for Terraform Register-ArgumentCompleter -Native -CommandName terraform -ScriptBlock { param($wordToComplete, $commandAst, $cursorPosition) $env:COMP_LINE=$commandAst.ToString() terraform | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) } Remove-Item Env:\COMP_LINE }