Last active
August 22, 2024 14:44
-
-
Save lkurzyniec/7a4078689e97f3f8ca81e7d4c67f042d 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
oh-my-posh init pwsh --config ~/lk.omp.json | Invoke-Expression | |
Import-Module -Name Terminal-Icons | |
Enable-PoshTooltips | |
if ($host.Name -eq 'ConsoleHost') | |
{ | |
Import-Module PSReadLine | |
Import-Module DockerCompletion | |
Set-PSReadLineOption -PredictionSource History # F2 to switch | |
# Set-PSReadLineOption -PredictionViewStyle ListView | |
} | |
# Chocolatey profile | |
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" | |
if (Test-Path($ChocolateyProfile)) { | |
Import-Module "$ChocolateyProfile" | |
} | |
# Chocolatey profile | |
# dotnet suggest shell start | |
# more info: https://github.com/dotnet/command-line-api/blob/main/docs/dotnet-suggest.md | |
if (Get-Command "dotnet-suggest" -errorAction SilentlyContinue) | |
{ | |
$availableToComplete = (dotnet-suggest list) | Out-String | |
$availableToCompleteArray = $availableToComplete.Split([Environment]::NewLine, [System.StringSplitOptions]::RemoveEmptyEntries) | |
Register-ArgumentCompleter -Native -CommandName $availableToCompleteArray -ScriptBlock { | |
param($wordToComplete, $commandAst, $cursorPosition) | |
$fullpath = (Get-Command $commandAst.CommandElements[0]).Source | |
$arguments = $commandAst.Extent.ToString().Replace('"', '\"') | |
dotnet-suggest get -e $fullpath --position $cursorPosition -- "$arguments" | ForEach-Object { | |
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) | |
} | |
} | |
} | |
else | |
{ | |
"Unable to provide System.CommandLine tab completion support unless the [dotnet-suggest] tool is first installed." | |
"See the following for tool installation: https://www.nuget.org/packages/dotnet-suggest" | |
} | |
$env:DOTNET_SUGGEST_SCRIPT_VERSION = "1.0.2" | |
# dotnet suggest script end | |
for($i = 2; $i -le 5; $i++){ | |
$d = "".PadLeft($i,".") | |
$u = "".PadLeft($i-1,".").Replace(".", "../") | |
Invoke-Expression "function $d { push-location $u }" | |
} | |
Set-Alias -Name tf -Value "C:\ProgramData\chocolatey\lib\terraform\tools\terraform.exe" -Scope Global | |
Set-Alias -Name ll -Value "ls" -Scope Global | |
Invoke-Expression (& { (zoxide init powershell | Out-String) }) | |
Write-Host "PowerShell Ready" -ForegroundColor Green |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Plugins: